1. 程式人生 > >python 讀取文件時報錯: UnicodeDecodeError: 'gbk' codec can't decode byte 0xa4 in position 127: illegal multibyte sequence

python 讀取文件時報錯: UnicodeDecodeError: 'gbk' codec can't decode byte 0xa4 in position 127: illegal multibyte sequence

報錯 error: open 解決辦法 post code 讀取文件 utf-8 gpo

UnicodeDecodeError: ‘gbk‘ codec can‘t decode byte 0xa4 in position 127: illegal multibyte sequence

python讀取文件時提示UnicodeDecodeError: ‘gbk‘ codec can‘t decode byte 0xa4 in position 127: illegal multibyte sequence

解決辦法:

FILE_OBJECT= open(‘order.log‘,‘r‘, encoding=‘UTF-8‘)

python 讀取文件時報錯: UnicodeDecodeError: 'gbk' codec can't decode byte 0xa4 in position 127: illegal multibyte sequence