Can webbrowser module get source code?

Benjamin Peterson benjamin at python.org
Sun Jan 25 01:08:01 CET 2009


Muddy Coder <cosmo_general <at> yahoo.com> writes:
> I want to go
> further: to get the source code of the webpage being displayed. Is it
> possible to do it? I tried webbrow.get() but didn't work. Somebody can
> help? Thanks!

To do this, you actually need to fetch the page yourself:

import urllib2
page_source = urllib2.urlopen("http://someaddress.com").read()

> 







More information about the Python-list mailing list