anaconda python2 编码问题
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')
        
        fout.write('<html>')
        fout.write('<body>')
        fout.write('<table>')
        
        # ascii
        for data in self.datas:
            fout.write('<tr>')
            fout.write('<td>%s</td>' %data['url'].encode('utf-8'))
            fout.write('<td>%s</td>' %data['title'].encode('utf-8'))
            fout.write('<td>%s</td>' %data['summary'].encode('utf-8'))           
            fout.write('</tr>')
        
        fout.write('</table>')
        fout.write('</body>')
        fout.write('</html>')
        fout.close()
在爬虫课程里,这个输出器,无论我加了encode或者decode,都会出现ascii编码错误,我用的是anaconda中的spyder python2.7 编译的,也在网上找了很多方法,包括那个reload(sys) 都不行,你们有谁能解决这个问题吗

 
                            