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