- 博客(1)
- 收藏
- 关注
原创 python爬虫结果写入html时编码错误
html一般采用的都是utf-8的编码,但是默认的编码时GBK。 1. open方法时采用 encoding=“utf-8” fout = open("output.html",mode="w",encoding="utf-8")结果:可以生成html文件但是打开后乱码如下 2. 对中文语句后加 .encode(“utf-8”)fout.write("%s"% data["titl
2018-01-20 16:21:13 2544 2
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人