Skip to content

Instantly share code, notes, and snippets.

@sakadonohito
Created October 22, 2012 00:43
Show Gist options
  • Select an option

  • Save sakadonohito/3929110 to your computer and use it in GitHub Desktop.

Select an option

Save sakadonohito/3929110 to your computer and use it in GitHub Desktop.
特定のURL内の画像が数字の連番の場合の画像取得サンプル
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import sys, urllib
import os.path
def download(url):
img = urllib.urlopen(url)
localfile = open( os.path.basename(url), 'wb')
localfile.write(img.read())
img.close()
localfile.close()
if __name__ == '__main__':
base_url = ''#ここに特定のパスをいれておく
#rangeはお好みで
for i in range(1,177):
download(base_url+("000" + str(i))[-3:]+'.jpg')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment