fileinput.input - newbie question

martijn at gamecreators.nl martijn at gamecreators.nl
Fri Sep 2 11:00:42 CEST 2005


I'm testing some writing/reading with a file and i'm not sure if it is
possible to print/use the line with fileinput.input inplace=1 (see
below)


import fileinput
thefile = fileinput.input('bla.txt',inplace=1,backup='.bak')
for line in thefile:
    if line != "1\n":
        print line,

    #is it possible to 'use' / print the 'line' on the screen here?

thefile.close()

When its not possible then I use 2 file's filein.txt,fileout.txt

Thanks,
GC-Martijn




More information about the Python-list mailing list