输出乱码问题
class HtmlOutputer(object):
def __init__(self):
self.datas=[]
def collect_data(self,data):
if data is None:
return
self.datas.append(data)
def output_html(self):
fout=open('output.html','w',encoding='utf-8')
fout.write('<html>')
fout.write('<body>')
#fout.write('<table>')
fout.write("<a>")
for data in self.datas:
#fout.write('<tr>')
#fout.write('<td>%s</td>'%data['url'])
#fout.write('<td>%s</td>'%data['title'])
#fout.write('<td>%s</td>'%data['summary'])
#fout.write('</tr>')
fout.write('<a href="%s">%s</a>' % (data['url'], data['title']))
fout.write('<p>%s</p>' % data['summary'])
#fout.write('</table>')
fout.write("</a>")
fout.write("</body>")
fout.write("</html>")
fout.close()
不管是视频中的还是网上查的,自己浏览器打开都是乱码,求大神帮助