热线电话:13121318867

登录
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')

30.4403
3
关注作者
收藏
评论(0)

发表评论

暂无数据
推荐帖子