piping into a python script

anonymous root at tiger.home
Fri Feb 1 05:34:54 EST 2008


I'm not sure I understane the question but my contribution is :

import sys
names = sys.argv[1:]

line = 'x'
while line:
     line = sys.stdin.readline().strip()
     if line: names.append (line)

print "names=", names

Called using:
ls |  stdtest.py arg1 arg2 arg3

Does this help?

Andy




More information about the Python-list mailing list