blob: 558fd740f3abe9ec61c889d333d003f7fb8aba85 [file] [log] [blame]
Guido van Rossumf06ee5f1996-11-27 19:52:01 +00001#! /usr/bin/env python
Guido van Rossumdfa70a91995-01-10 17:05:37 +00002
3# www1.py -- print the contents of a URL on stdout
4
5import sys
6import urllib
7
8def main():
9 if len(sys.argv) != 2 or sys.argv[1][:1] == '-':
10 print "Usage:", sys.argv[0], "url"
11 sys.exit(2)
12 url = sys.argv[1]
13 fp = urllib.urlopen(url)
14 while 1:
15 line = fp.readline()
16 if not line: break
17 print line,
18
19main()