首先代码开头:
# -*- coding: utf-8 -*-
importsys
reload(sys)
sys.setdefaultencoding('utf-8')
最后还是报错:如下
写入文件错误,解决办法:
with open('renren.html','w') as f:
f.write(html.encode('utf-8'))
首先代码开头:
# -*- coding: utf-8 -*-
importsys
reload(sys)
sys.setdefaultencoding('utf-8')
最后还是报错:如下
写入文件错误,解决办法:
with open('renren.html','w') as f:
f.write(html.encode('utf-8'))