求助求助
用python打开文件的时候显示Traceback (most recent call last):
File "<pyshell#6>", line 1, in <module>
w.read()
UnicodeDecodeError: 'gbk' codec can't decode byte 0xad in position 22: illegal multibyte sequence
怎么解决,还有这是为什么呢
编码问题,open函数中加个参数 encoding='utf-8’ w = open("文件名",encoding = "utf8")
w.read() with open(filename , 'rb',encoding = 'utf-8') 青出于蓝 发表于 2022-7-14 17:02
编码问题,open函数中加个参数 encoding='utf-8’
它原因是什么啊,就是什么编码问题
页:
[1]