Created by: myd7349
Since the default system encoding of my Win7 x64(simplified Chinese) is not utf-8, but GBK; sort.py doesn't work in Python 3.4.2.
The traceback message is:
Traceback (most recent call last): File "E:\GitHub\sort.py", line 52, in main() File "E:\GitHub\sort.py", line 22, in main read_me = read_me_file.readlines() UnicodeDecodeError: 'gbk' codec can't decode byte 0x93 in position 6947: illegal multibyte sequence
So I just specify the encoding explicitly by passing the keyword argument 'encoding'. (Otherwise, Python 3.x will use the system's default encoding.)
The builtin 'open' function in Python 2.7.8 doesn't provide such a parameter, however. So I use codecs.open instead.
The modified version has already been tested on Win7 x64 with both Python 2.7.8 and Python 3.4.2.