最近对Python挺感兴趣的,在网上看到一个Python爬虫程序,爬取网页上图片,于是自己也尝试了一下,想实现获取每一页的图片。

但是程序出现了一个bug,就是获取到第二页的某个图片的时候,结果弹错了

具体程序如下

弹出的错误如下:

Traceback (most recent call last):
File "F:Pythonclawsrcclaw_first.py", line 28, in <module>
getAllImageLink()
File "F:Pythonclawsrcclaw_first.py", line 23, in getAllImageLink
urllib.urlretrieve(link,filesavepath)
File "C:Python27liburllib.py", line 98, in urlretrieve
return opener.retrieve(url, filename, reporthook, data)
File "C:Python27liburllib.py", line 233, in retrieve
url = unwrap(toBytes(url))
File "C:Python27liburllib.py", line 1075, in unwrap
url = url.strip()
AttributeError: ‘NoneType’ object has no attribute ‘strip’

2 收藏


直接登录
最新评论