Python UnicodeDecodeError: 'gbk' codec can't decode byte 0x80
Python 大约 279 字Python读取文件保存
Traceback (most recent call last):
File "D:/test.py", line 2, in <module>
line = f.readline()
UnicodeDecodeError: 'gbk' codec can't decode byte 0x80 in position 2093: illegal multibyte sequence
解决办法
指定编码为UTF-8
file = open('log.log','r', encoding='UTF-8')
阅读 3440 · 发布于 2019-04-18
————        END        ————
Give me a Star, Thanks:)
https://github.com/fendoudebb扫描下方二维码关注公众号和小程序↓↓↓

昵称:
随便看看
换一批
-
Oracle ORA-01502: index 'INDEX_NAME' or partition of such index is in unusable state阅读 2318
-
macOS 打开 Java Mission Control 直接闪退解决方法阅读 100
-
Git 合并两个分支阅读 2013
-
Spring Boot 将 InputStream 输入流转换为 String阅读 471
-
MySQL 聚合函数阅读 1031
-
Spring Boot 中去除 spring-data-mongodb 自动生成的 _class 字段阅读 4141
-
Spring Boot 使用 @Valid 校验前端传递的参数阅读 4535
-
Java jar 包启动时指定 JVM 时区阅读 5356
-
macOS Homebrew 报错 not in a git directory阅读 64
-
Nginx 解决前端 CORS 跨域问题阅读 9173