|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
以下为照着小甲鱼打教程学习过程中出现打问题(为什么教程上直接使用read可以打开读取txt文件),请各位指教:
环境:mac 打开一个docx文件
>>> f = open('a.docx')
>>> f
<_io.TextIOWrapper name='a.docx' mode='r' encoding='US-ASCII'>
>>> u = f.read()
Traceback (most recent call last):
File "<pyshell#3>", line 1, in <module>
u = f.read()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0x8a in position 15: ordinal not in range(128)
|
|