In article <[email protected]>, Lie Ryan <[email protected]> wrote: > >f = open('input.txt', 'r+') >for line in f: > s = line.replace('python', 'PYTHON') > # f.tell() > f.write(s) > >When f.tell() is commented, 'input.txt' does not change; but when >uncommented, the f.write() succeeded writing into the 'input.txt' >(surprisingly, but not entirely unexpected, at the end of the file).
Another possible issue is that using a file iterator is generally not compatible with direct file operations. -- Aahz ([email protected]) <*> http://www.pythoncraft.com/ import antigravity -- http://mail.python.org/mailman/listinfo/python-list
