蠢蠢110 发表于 2020-8-26 07:36:53

小白:文件读取出现错误

>>> f=open('D:\\python自学\\20200721.doc')
>>> f
<_io.TextIOWrapper name='D:\\python自学\\20200721.doc' mode='r' encoding='cp936'>
>>> f.read()
Traceback (most recent call last):
File "<pyshell#51>", line 1, in <module>
    f.read()
UnicodeDecodeError: 'gbk' codec can't decode byte 0xb1 in position 5: illegal multibyte sequence
>>>

zltzlt 发表于 2020-8-26 07:37:38

用 open() 不能读取 .doc 文档

liuzhengyuan 发表于 2020-8-26 07:39:51

open 不能读取带格式的文档
页: [1]
查看完整版本: 小白:文件读取出现错误