拒绝社死 2022-02-12 11:52 采纳率: 75%
浏览 38
已结题

出现了错误UnicodeDecodeError

输入代码

img


img

代码里有encoding='utf-8',为社么还是会显示UnicodeDecodeError: 'gbk' codec can't decode byte 0x80 in position 71: illegal multibyte sequence

img

  • 写回答

4条回答 默认 最新

  • 关注
    stopword = [line.strip() for line in open(filepath, 'r').readlines()]
    

    这一行的open()中加 encoding='utf-8' 参数, 改成

    stopword = [line.strip() for line in open(filepath, 'r', encoding='utf-8').readlines()]
    

    img

    如有帮助,请点击我的回答下方的【采纳该答案】按钮帮忙采纳下,谢谢!

    img

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论 编辑记录
查看更多回答(3条)

报告相同问题?

问题事件

  • 系统已结题 2月21日
  • 已采纳回答 2月13日
  • 创建了问题 2月12日