问题描述
- python下载图片出现IOError
-
import urllib2 from BeautifulSoup import BeautifulSouppage = urllib2.urlopen('http://bbs.hupu.com/13608969.html') contents = page.read() soup = BeautifulSoup(contents)img=soup.findAll('img')print imgprint len(img)for myimg in img: link=myimg.get('src') print link content2 = urllib2.urlopen(link).read() with open(u'E:img'+'/'+link[-11:]'wb') as code: code.write(content2)
解决方案
你的文件名中怎么能有星号,文件名不能有星号问号冒号这些字符
解决方案二:
python下载图片
python 下载图片
python 下载图片
时间: 2024-08-04 01:34:40