lolamontes69

Python/ Download files listed in doggypix.txt

May 16th, 2013
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.43 KB | None | 0 0
  1. import urllib
  2. from time import sleep
  3.  
  4. file1 = open('doggypix.txt')
  5. for g in file1:
  6.     loadthis = g.strip()
  7.     g = g.strip()
  8.     while '/' in g:
  9.         head, sep, tail = g.partition('/')
  10.         g = tail
  11.     print g,loadthis
  12.     f = open(g,'wb')
  13.     f.write(urllib.urlopen(loadthis).read())
  14.     sleep(0.5)
  15.     f.close()
  16.  
  17. print "------------FINISHED-------------"
  18.  
  19. """ Download files (eg jpg) listed in doggypix.txt """
Add Comment
Please, Sign In to add comment