1. 程式人生 > >Python指令碼1:批量獲取圖片下載到本地

Python指令碼1:批量獲取圖片下載到本地

#  根據圖片連結列表獲取圖片儲存到本地
#coding=utf-8
import urllib.request
image_url = [
'http://i2.bvimg.com/649796/f8b21c027df0a0c8.png',
'http://i2.bvimg.com/649796/792c5ad474c49308.jpg',
'http://i2.bvimg.com/649796/529498f8ac94a9ea.png',
'http://i2.bvimg.com/649796/2e5e331aab07f7e3.jpg',
'http://i2.bvimg.com/649796/a89c1236a325059d.png',
'http://i2.bvimg.com/649796/3618fa9647fe512e.jpg',
'http://i2.bvimg.com/649796/c9e44468856d94b3.png',
'http://i2.bvimg.com/649796/a8ca6bc1fb01c84f.jpg',
'http://i2.bvimg.com/649796/6f027d1cb7f45548.png',
'http://i2.bvimg.com/649796/e11401a0e3ab989b.jpg',
'http://i2.bvimg.com/649796/42b8382fb5e8211a.png',
'http://i2.bvimg.com/649796/48bb7e7f62cd6cc7.jpg',
'http://i2.bvimg.com/649796/0aa922b25a24e1ad.png',
'http://i2.bvimg.com/649796/9b2321b38534a662.jpg',
'http://i2.bvimg.com/649796/b55002be74b794ca.png',
'http://i2.bvimg.com/649796/f228df888f30efa3.jpg',
'http://i2.bvimg.com/649796/45028c9a8830156c.png',
'http://i2.bvimg.com/649796/25eb46043ea06863.jpg',
'http://i2.bvimg.com/649796/10e02b8dd126cfb3.png',
'http://i2.bvimg.com/649796/72a4d659fde343c4.jpg',
'http://i4.bvimg.com/649796/95aef107c08d44ea.png',
'http://i4.bvimg.com/649796/009e2431a561ba6e.jpg',
'http://i4.bvimg.com/649796/7b217a0b79c86359.jpg',
'http://i4.bvimg.com/649796/d688784e826fce36.jpg',
'http://i4.bvimg.com/649796/e55695f5d34b9e31.jpg',
'http://i4.bvimg.com/649796/4230cc57f7b4efc0.jpg'
]
i=1
for item in image_url:
 urllib.request.urlretrieve(item,"E:\ckb\\%s.jpg"%(i))
 i+=1