UnicodeDecodeError: 'gbk' codec can't decode byte 0x80 in position 16: illegal multibyte sequence

  • 报错
    UnicodeDecodeError: 'gbk' codec can't decode byte 0x80 in position 16: illegal multibyte sequence
  • The reason
    documents are Chinese, do not specify the encoding type in the open function
  • Resolve
    fp = open('text.txt')
    into
    fp = open('text.txt',encoding='utf-8')

Guess you like

Origin www.cnblogs.com/peng8098/p/11112188.html