返回codecs.charmap_decode(input,self.errors,decoding_table)[0] UnicodeDecodeError:“ charmap”编解码器无法解码位置的字节0x81 1020:字符映射到
当我尝试读取Word文档程序docx或其中包含表格的doc时出现此消息。对于没有表格的文档,它不会引发此错误。这是程序:
with open('Testy.docx') as file:
contents = file.read()
a1 = "mother"
a2 = "father"
a3 = "sister"
a4 = "brother"
if a1 in contents:
print ('best in the world')
if a2 in contents:
print("tough but fair")
if a3 in contents:
print('awesome')
if a4 in contents:
print("punchbag")
else:
print ('nothing found')
任何帮助都将受到超级赞赏