fileinput.input('test.txt') => ERROR: input() already active

cyberco cyberco at gmail.com
Mon Nov 20 10:58:47 CET 2006


Ah, thanks!
Another related question I have: The following piece edits in place,
but ads whitelines between all lines of a Windows text file. Why?

===========================
fi = fileinput.input('test.txt', inplace=1)
for l in fi:
    print l.replace('a', 'b')
===========================




More information about the Python-list mailing list