bruno at modulix a écrit : > Tommy B wrote: > >>bruno at modulix wrote: > > > (snip) > > >>>import os >>>old = open("/path/to/file.txt", "r") >>>new = open("/path/to/new.txt", "w") >>>for line in old: >>> if line.strip() == "Bob 62" >>> line = line.replace("62", "66") >>> new.write(line) >>>old.close() >>>new.close() >>>os.rename("/path/to/new.txt", "/path/to/file.txt") >>> > > (snip) > >>Umm... I tried using this method and it froze. Infiinite loop, I'm >>guessing. > > > Wrong guess - unless, as Fredrik suggested, you have an infinite disk > with an infinite file on it. If so, please share with, we would be > *very* interested !-)
Use /dev/zero as source and /dev/null as destination :D -- http://mail.python.org/mailman/listinfo/python-list