[Solved] Error when Python reads a file Unicode decodeerror

python read files error: UnicodeDecodeError: ‘gbk’ codec can’t decode byte 0x80 in position 205: illegal multibyte sequence

python read file warning: “UnicodeDecodeError: ‘gbk’ codec can’t decode byte 0x80 in position 205: illegal multibyte sequence”

Solution 1:

FILE_OBJECT= open('data.txt','r', encoding='UTF-8')

Solution 2:

FILE_OBJECT= open('data.txt','rb')

 

Similar Posts: