|
发表于 2006-1-1 06:02:47
|
显示全部楼层
[color="SeaGreen"]cat.py cat.py
[HTML]#!/usr/bin/python
import sys
try:
filename=sys.argv[1]
except:
print " cat.py Version 0.0.9"
print " A cat like python script. This is free software,"
print " under the terms of the GNU General Public License"
print " http://www.gnu.org/licenses/gpl.html"
print " There is NO WARRANTY."
print "Usage: cat.py filename\n"
else:
try:
fd=file(filename,'r',0)
except:
print "Can not open \"%s\"." % filename
else:
for line in fd:
print line,
fd.close()[/HTML] |
|