python读取txt中文乱码
问题读取txt文件中文乱码with open('C:\\Users\\11342\\Desktop\\python\\1.txt') as f1: print(f1.read())执行解决在open()中加入参数 encoding=‘UTF-8’ 就行了with open('C:\\Users\\11342\\Desktop\\python\\1.txt',encoding='UTF-8') as f1: print(f1.read())open() 方法Python
原创
2021-12-15 15:27:29 ·
7316 阅读 ·
0 评论