-1
我正在寫一個程序來計算python(3.6)的單詞,代碼從終端平穩運行。但是如果我使用python IDLE,會發生下面的錯誤:關於UnicodeDecodeError
Traceback (most recent call last):
File "/Users/zhangchaont/python/Course Python Programming/6.7V2.py", line 122, in <module>
main()
File "/Users/zhangchaont/python/Course Python Programming/6.7V2.py", line 21, in main
for line in txtFile:
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe3 in position 33: ordinal not in range(128)
如何解決這個問題?
請參閱代碼片段 – brennan