‘gbk‘ codec can‘t decode byte 0xa2 in position 50: illegal multibyte sequence

在python中读取word文档很麻烦,不像读取txt文件用with open就行,非要用with open打开的话,用以下方法:

一、用拉丁文编码

encoding="latin-1" 如果你看得懂拉丁文的话

二、用二进制流

with open(fileName,'rb')

但最好用 python-docx包

你可能感兴趣的:(乱码)