File "E:\python\projectexam\baike\spider_main.py", line 32, in <module>
obj_spider.craw(root_url)
File "E:\python\projectexam\baike\spider_main.py", line 13, in craw
while self.urls.has_new_url():
AttributeError: 'SpiderMain' object has no attribute 'urls'
obj_spider.craw(root_url)
File "E:\python\projectexam\baike\spider_main.py", line 13, in craw
while self.urls.has_new_url():
AttributeError: 'SpiderMain' object has no attribute 'urls'
2016-10-22
import urllib.request
url = 'http://www.baidu.com'
print('第一种方法')
response1 = urllib.request.urlopen(url)
print(response1,getcode())
print(len(response1))
url = 'http://www.baidu.com'
print('第一种方法')
response1 = urllib.request.urlopen(url)
print(response1,getcode())
print(len(response1))
2016-10-21
不能像老师一样直接ctrl+1导入re和urlparse啊,我crtl+1之后没有那个选项,其他的都有,有没有大神能解释下
2016-10-21
@xiaoqiang_123 head meta charset="utf-8" 这个改一下就可以了
2016-10-20
在from bs4 import beautifulsoup中 unresolved import:beautifulsoup解决方法:
右击项目,属性;选择"PyDev-Interpreter/Grammar";
点击链接"Click here to configure an interpreter not listed." ;
在"Libraries"内,点击"new egg/zip(s)",导入egg文件;
比如我的路径:C:\Python27\Lib\site-packages\beautifulsoup4-4.5.1-py2.7.egg
完成后重启
右击项目,属性;选择"PyDev-Interpreter/Grammar";
点击链接"Click here to configure an interpreter not listed." ;
在"Libraries"内,点击"new egg/zip(s)",导入egg文件;
比如我的路径:C:\Python27\Lib\site-packages\beautifulsoup4-4.5.1-py2.7.egg
完成后重启