File "G:\Myeclipse\imooc_py\test\test_bs4.py", line 2
SyntaxError: Non-ASCII character '\xc4' in file G:\Myeclipse\imooc_py\test\test_bs4.py on line 3, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details
那些html/href都有红色波浪线
SyntaxError: Non-ASCII character '\xc4' in file G:\Myeclipse\imooc_py\test\test_bs4.py on line 3, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details
那些html/href都有红色波浪线
2017-08-17
已采纳回答 / 小白汤付颖8169924号
你代码里的第一行应该是request=urllib.request.Request(url),第一个request是3.0环境下的urllib.request,第二个Request是创建的类
2017-08-14
https://github.com/oldbig-carry/python_baidu_spider 基于python3 亲测成功 2017/8/13 欢迎fork,star就更好了
可以把table,td改成a,p,输出的html会整齐些
for data in self.datas:
fout.write('<a href="%s">%s</a>' % (data['url'],data['title']))
fout.write('<p>%s</p>' % data['summary'])
for data in self.datas:
fout.write('<a href="%s">%s</a>' % (data['url'],data['title']))
fout.write('<p>%s</p>' % data['summary'])
2017-08-12