Chosing between sys.argv and sys.stdin
Arne Martin Güettler
arneh++ at ifi.uio.no
Sat Oct 28 12:00:21 EDT 2000
Steve Holden wrote:
>
> Probably what you need is something like the following, which
> will work for a single file name. You can easily extend it to
> multiple filenames (left as an exercise to the reader...)
something like:
myfiles = map(open, sys.argv[1:]) or [sys.stdin]
for file in myfiles:
input = file.read()
(put inside try-except for error handling)
--
Arne Martin
More information about the Python-list
mailing list