我有一些图片的 url 列表,我想下载它们 import urllib
links = ['http://www.takamine.com/templates/default/images/gclassical.png',
'https://dk1xgl0d43mu1.cloudfront.net/user_files/esp/product_images/000/010/120/large.png?1389980652',
'https://dk1xgl0d43mu1.cloudfront.net/user_files/esp/product_images/000/020/676/large.png?1453396324']
#urllib.urlretrieve('http://www.takamine.com/templates/default/images/gclassical.png','image.jpg')
for i in range(0,4):
S1 = 'image'
S2 = '.png'
name = list()
x = S1 + str(i) + S2
name.append(x)
for q in links:
urllib.urlretrieve(q,name)
我了解如何一次检索一个....当我尝试此代码时,我收到此错误
回溯(最后一次调用):文件“C:/Python27/metal memes/test1.py”,第 17 行,在 urllib.urlretrieve(q,name) 文件“C:\Python27\lib\urllib.py”,行98、在 urlretrieve return opener.retrieve(url, filename, reporthook, data) File "C:\Python27\lib\urllib.py", line 249, in retrieve tfp = open(filename, 'wb') TypeError: coercing to Unicode:需要字符串或缓冲区,找到列表
任何答案,解释表示赞赏