f = open('C://Users//fireqwert7//Documents//tesis.docx')
sts=''
for line in f:
sts += line
print(sts)
f.close()
Traceback (most recent call last):
File "C:\Python32\regularexpressions.py", line 11, in <module>
for line in f:
File "C:\Python32\lib\encodings\cp1252.py", line 23, in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 66: character maps to <undefined>
如果可以我會很感激,如果你能告訴我爲什麼會發生,以及如何避免下一次。我討厭使用我不明白的東西。
這幾乎肯定不會給你任何可用的輸出。 –
你想達到什麼目的?你正在閱讀一個docx文件(這是壓縮的XML),就好像它是一些編碼的文本文件。 –