错误展示:UnicodeDecodeError: ‘gbk’ codec can’t decode byte 0xaf in position 24: illegal multibyte sequence
原因分析:一般出现在读取txt文件等过程中,会出现编码错误,
解决办法:添加代码:
f_path=r'D:\\Python\\airpm25.txt'
with open(f_path,encoding = "UTF-8") as f:
contents=f.read
错误展示:UnicodeDecodeError: ‘gbk’ codec can’t decode byte 0xaf in position 24: illegal multibyte sequence
原因分析:一般出现在读取txt文件等过程中,会出现编码错误,
解决办法:添加代码:
f_path=r'D:\\Python\\airpm25.txt'
with open(f_path,encoding = "UTF-8") as f:
contents=f.read