Entry
Opening URLs
Jul 5th, 2000 10:01
Nathan Wallace, unknown unknown, Hans Nowak, Snippet 199, Martin von Loewis
"""
Packages: networking.internet
"""
"""
> 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()
print s[0]
#'<HTML>\012'
print s[1]
#'<!-- THIS PAGE IS AUTOMATICALLY GENERATED. DO NOT EDIT. -->\012'