download complete webpage with python

James Matthews nytrokiss at gmail.com
Sat Dec 8 17:02:41 EST 2007


from urllib import urlopen
url = urlopen("http://www.google.com").read()

Enjoy!

On 12/8/07, Larry Bates <larry.bates at websafe.com> wrote:
>
> Gabriel Genellina wrote:
> > En Fri, 07 Dec 2007 17:58:43 -0300, yi zhang <zhang1025 at yahoo.com>
> > escribió:
> >
> >> The urllib.urlretrieve() can only download the text part of a webpage,
> >> not the image associated. How can I download the whole, complete
> >> webpage with python? Thanks!
> >
> > The images are separate from the html document. You have to parse the
> > html text, find the <img> tags, and retrieve them.
> >
> Actually IMHO this is even more difficult than it sounds.  Javascript can
> change
> the webpage after it loads.
>
> Larry
> --
> http://mail.python.org/mailman/listinfo/python-list
>



-- 
http://search.goldwatches.com/?Search=Movado+Watches
http://www.jewelerslounge.com
http://www.goldwatches.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20071208/890ff1a8/attachment.html>


More information about the Python-list mailing list