python报错:
UnicodeDecodeError: 'gbk' codec can't decode byte 0xad in position 14: illegal multibyte sequence
原因:txt是utf-8编码,所以编码需要转为utf-8
1.找到报错的代码行:
f = open('gp.txt','r')
2.将代码改为:
f = open("gp.txt",encoding='utf-8').read()
python报错:
UnicodeDecodeError: 'gbk' codec can't decode byte 0xad in position 14: illegal multibyte sequence
原因:txt是utf-8编码,所以编码需要转为utf-8
1.找到报错的代码行:
f = open('gp.txt','r')
2.将代码改为:
f = open("gp.txt",encoding='utf-8').read()