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')
===========================