File "E:/download/untitled/baike/spider_main.py", line 33, in <module>
obj_spider.craw(root_url)
File "E:/download/untitled/baike/spider_main.py", line 20, in craw
new_urls,new_data=self.parser.parse(new_url,html_cont)
TypeError: 'NoneType' object is not iterable
obj_spider.craw(root_url)
File "E:/download/untitled/baike/spider_main.py", line 20, in craw
new_urls,new_data=self.parser.parse(new_url,html_cont)
TypeError: 'NoneType' object is not iterable
使用python的同学注意了!
如果出现乱码的话,将fout.write('<td>%s<td>' % data['title'] ) 改为
fout.write("<td>")
fout.write(data['title'])
fout.write("</td>")
并且在文件打开语句改为:fout = open('output.html', 'w', encoding='utf-8')
这样就不会出现乱码了
如果出现乱码的话,将fout.write('<td>%s<td>' % data['title'] ) 改为
fout.write("<td>")
fout.write(data['title'])
fout.write("</td>")
并且在文件打开语句改为:fout = open('output.html', 'w', encoding='utf-8')
这样就不会出现乱码了
2016-09-28
打印异常信息说没有get_text的方法('NoneType' object has no attribute 'get_text')
2016-09-27
本人浏览器默认打开导出html编码为gbk乱码,建议咋html指定编码
fout=open('output1.html','w')
fout.write("<html>")
fout.write("<head>")
fout.write("<meta charset=""UTF-8"">")
fout.write("<body>")
fout=open('output1.html','w')
fout.write("<html>")
fout.write("<head>")
fout.write("<meta charset=""UTF-8"">")
fout.write("<body>")
2016-09-25