UnicodeDecodeError: 'gbk' codec can't decode byte 0x80 in position 16: illegal multibyte sequence
原文链接:http://www.one2know.cn/bug2/
- 报错
UnicodeDecodeError: 'gbk' codec can't decode byte 0x80 in position 16: illegal multibyte sequence - 原因
文档是中文,在open函数中没有指定编码类型 - 解决
fp = open('text.txt')
改成
fp = open('text.txt',encoding='utf-8')