Opening url's
Martin von Loewis
loewis at informatik.hu-berlin.de
Fri Oct 22 16:03:20 EDT 1999
rainer2207 at my-deja.com writes:
> Can anyone tell me how I can open a page given a URL? There seems to be
> very little documentation on urllib abd I haven't seen any examples. I
> have a CGI script which calls another CGI script. I would like this
> CGI script to call the CGI script it came from. Can anyone help? Thanks.
Please have a look at the urllib documentation, at
http://www.python.org/doc/current/lib/module-urllib.html
A simple example follows:
>>> import urllib
>>> f=urllib.urlopen("http://www.python.org/")
>>> s=f.readlines()
>>> s[0]
'<HTML>\012'
>>> s[1]
'<!-- THIS PAGE IS AUTOMATICALLY GENERATED. DO NOT EDIT. -->\012'
Hope this helps,
Martin
More information about the Python-list
mailing list