- 博客(1)
- 收藏
- 关注
原创 python爬虫爬取百度存成html出现中文乱码情况
写的爬虫代码爬取百度页面,存成txt格式的或者直接输出下面代码都是正常的,不会出现乱码情况,但是一旦存成html之后打开就出现中文乱码。from urllib.request import urlopenurl = "http://www.baidu.com"resp = urlopen(url)with open("mybaidu.html",mode="w") as f: f.write(resp.read().decode("utf-8"))print("over!")..
2021-11-05 22:25:48 2830 5
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人