在处理标题或网址为中文的文件或网页的时候,报UnicodeEncodeError: 'latin-1' codec can't encode characters in position 41-50: ordinal not in range(256)错误,解决办法很简单。如下:

#只需将中文encode一下即可
name = '中文'.encode('utf-8')

完美解决!

相关文章:

  • 2021-06-29
  • 2021-09-15
  • 2021-11-04
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-01
  • 2022-01-01
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案