报错:SyntaxError:Non-UTF-8 code starting with '\x..' in file ...

1 #获得没法识别的字节错误:"Incorrect string value:'\\xF0\\xAB\\x96\\xAF\\xE7\\x9A...',把字节错误的地方换成?
2 errorbytes = [b'\xF0\xAB\x96\xAF\xE7\x9A',b'\xF0\xA8\xA8\x97\xEF\xBC']
3 for eb in errorbytes:
4     data['intro'] = [x.encode('utf8', errors='replace').replace(eb, b'?').decode('utf8'
5                      , errors='replace') for x in list(data['intro'])]

 

相关文章:

  • 2022-01-08
  • 2022-12-23
  • 2022-12-23
  • 2021-04-01
  • 2021-12-18
  • 2022-01-08
  • 2021-06-09
  • 2022-12-23
猜你喜欢
  • 2021-06-26
  • 2021-10-07
  • 2022-01-08
  • 2022-12-23
  • 2022-01-11
  • 2021-05-20
相关资源
相似解决方案