Modifying a row in a textfile

Diez B. Roggisch deets at
Tue Sep 8 14:21:59 CEST 2009

Olli Virta wrote:

> Hi!
> I got a textfile made out of database records. Is there an easy way to
> modify rows in that file in case you have to take away some items here
> and there from each rows.

for line in inf.readlines():
    if matches_criteria(line):
       line = modify_line(line)


More information about the Python-list mailing list