写网页内容代码报错

来源:3-2 Requests 模块请求网页数据

慕娘8588455

2023-03-12

with open("./C03L02/index.html", "w") as f:
    f.write(res.text)

报错

UnicodeEncodeError: 'gbk' codec can't encode character '\xa0' in position 598288: illegal multibyte sequence
写回答

1回答

Martin__Wang

2023-03-12

with open("./C03L02/index.html", "w", encoding="utf-8") as f:

f.write(res.text)

0
1
慕娘8588455
弄好了,谢谢老师
2023-03-13
共1条回复

Python 分布式爬虫与 JS 逆向进阶实战

20+ 案例 & 可接单级项目,全面提升爬虫实战能力

99 学习 · 26 问题

查看课程