python文件之读取文件报错

一、出现的错误:UnicodeDecodeError: 'gbk' codec can't decode byte 0x80 in position 9141: illegal multibyte sequence



二、解决方法:

修改代码为:

with open("html.txt",encoding="utf-8") as f:
    html = f.read()

posted @ 2020-12-25 22:16  亨利其实很坏  阅读(197)  评论(0)    收藏  举报