Java OpenResty Spring Spring Boot MySQL Redis MongoDB PostgreSQL Linux Android Nginx 面试 小程序 Arthas JVM AQS juc Kubernetes Docker DevOps


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')
阅读 3073 · 发布于 2019-04-18

————        END        ————

Give me a Star, Thanks:)

https://github.com/fendoudebb

扫描下方二维码关注公众号和小程序↓↓↓

扫描二维码关注我
昵称:
随便看看 换一批