urllib2 - Downloading a picture via urllib and python -
So I'm trying to create a Python script that downloads webcmix and puts them in the folder on my desktop . I have seen some such programs here that do something similar, but I do not like anything. The way I got the most, it's fine () I tried to use this code:
& gt; & Gt; & Gt; Import urllib & gt; & Gt; & Gt; Image = urllib.URLopener () & gt; & Gt; & Gt; Image.retrieve ("http://www.gunnerkrigg.com//comics/00000001.jpg", "00000001.jpg") ('00000001.jpg', & lt; httplib.HTTPMessage Example 0x1457a80 & gt;)
Then I searched for my computer for "00000001.jpg", but the cached image of what I got was the picture. I do not even believe this file was saved on my computer. Once I understand how to download files, I think how to handle the rest. I essentially only use one loop and split the string on '00000000' 'jpg' and '00000000' To the largest number, which I have to define in some way. The best way to do this, or how to download the file properly?
Thank you!
Edit 6/15/10
The script is completed here, it saves the files in any of the directories you have selected. For some strange reasons, the files are not downloaded. And they did just now. Any suggestion about how to clean it will be highly appreciated. I am currently working on how many comics exist on the site, so I can get the latest one instead of leaving the program after raising few exceptions.
:
import urllib urllib.urlretrieve ("http: // wwwun Nerkrigg.com//comics/00000001.jpg", "00000001.jpg" )
Comments
Post a Comment