view page source or save after load

James Stroud jstroud at mbi.ucla.edu
Thu Sep 21 01:14:40 EDT 2006


zephron2000 wrote:
> Hey,
> 
> I need to either:
> 
> 1. View the page source of a webpage after it loads
> 
> or
> 
> 2. Save the webpage to my computer after it loads (same as File > Save
> Page As)
> 
> urllib is not sufficient (using urlopen or something else in urllib
> isn't going to do the trick)
> 
> Any ideas?
> 
> Thanks,
> Lara
> 
> 
> 

I happen to be tweaking a module that does this as your question came 
in. The relevant lines are:

fetchparams = urllib.urlencode(fetchparams)
wwwf = urllib.urlopen("?".join([baseurl, fetchparams]))
afile = open(filename, "w")
afile.write(wwwf.read())
afile.close()

James

-- 
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095

http://www.jamesstroud.com/



More information about the Python-list mailing list