python open报错:‘gbk‘ codec can‘t decode byte 0xbd in position xxxx: illegal multibyte sequence

it2023-03-06  83

python 打开文件:

f = open(logpath, 'r') buff = f.read()

出错:UnicodeDecodeError: 'gbk' codec can't decode byte 0xbd in position 135129: illegal multibyte sequence

解决办法:

f = open(logpath, 'r', encoding='utf-8')
最新回复(0)