1. 程式人生 > 其它 >UnicodeEncodeError: ‘gbk’ codec can’t encode character ‘\u200b’ in position 80: illegal multibyte se

UnicodeEncodeError: ‘gbk’ codec can’t encode character ‘\u200b’ in position 80: illegal multibyte se

技術標籤:Linux--編碼

UnicodeEncodeError: ‘gbk’ codec can’t encode character ‘\u200b’ in position 80: illegal multibyte sequence

寫入檔案時,python報錯:

    f.write(js)
UnicodeEncodeError: 'gbk' codec can't encode character '\u200b' in position 80: illegal multibyte sequence

修改編碼格式:

f = open("news_data.txt"
, "a", encoding='ISO-8859-1')