我遇到编码/解码问题。我根本无法让我的简单程序读取。
def testfunk ():
filnamn2 = "arbete.txt"
filnamn = open("arbete.txt", "r")
utfil = open("arbetad.txt", "w")
inrad = filnamn.readline()
生成错误代码:
Traceback (most recent call last):
File "test.py", line 24, in <module>
testfunk()
File "test.py", line 9, in testfunk
inrad = filnamn.readline()
File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 29: ordinal not in range(128)
如何简单地解决这个问题?