小白:文件读取出现错误
>>> 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
>>> 用 open() 不能读取 .doc 文档 open 不能读取带格式的文档
页:
[1]