2020-05-09
阅读量:
704
Python报错UnicodeDecodeError: 'gbk' codec can't decode byte

这个报错是编码问题,如果文件为gbk编码方式,需要在读写数据的时候设置enconding为utf-8
正确写法为:
f=open("c:/Users/dongs/Desktop/python/drink_wine.txt",'r',enconding='utf-8')






评论(0)


暂无数据
推荐帖子
0条评论
0条评论
3条评论