[Tutor] Download an image of a site?
Joseph Quigley
cpu.crazy at gmail.com
Tue Sep 13 16:51:09 CEST 2005
Kent Johnson wrote:
> I don't think the object returned from urllib2.urlopen() has save() and get() > methods. According to the docs urlopen() "returns a file-like object with two
> additional methods:
>
> * geturl() -- return the URL of the resource retrieved
> * info() -- return the meta-information of the page, as a dictionary-like object"
>
> So you should treat data.f like an open file - use read() to get the contents into a > variable. Then open a real (disk) file for writing and write it out. This section of > the Python tutorial has a quick intro:
> http://docs.python.org/tut/node9.html#SECTION009200000000000000000
>
> Kent
Thanks. I will check this out and let you know if I can get it to work.
More information about the Tutor
mailing list