[Tutor] fileinput

David Jansen djansen@pobox.com
Sun, 23 Jul 2000 09:11:51 +0900


I wanted to try out this idiom I came across in comp.lang.python but I am
getting an attribute error...


import fileinput

for line in fileinput.input('d:\python\test.txt'):
    print line

Traceback (innermost last):
  File "C:\Program Files\Python\Pythonwin\pywin\framework\scriptutils.py",
line 310, in RunScript
    exec codeObject in __main__.__dict__
  File "D:\Python\fileInput.py", line 3, in ?
    for line in fileinput.input("D:\Python\test.txt"):
AttributeError: input

I checked the documentation and the above is typical usage...

Thank you,
David Jansen