repo.or.cz
/
python
/
dscho.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
Don't reference removed files in Makefile
[python/dscho.git]
/
Demo
/
tkinter
/
www
/
www1.py
blob
dc30e215ad189c313f6378db31d40f93c9c16dcd
1
#! /usr/local/bin/python
2
3
# www1.py -- print the contents of a URL on stdout
4
5
import
sys
6
import
urllib
7
8
def
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
19
main
()