In article <4b617f4...@dnews.tpgi.com.au>, Lie Ryan <lie.1...@gmail.com> 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 (a...@pythoncraft.com) <*> http://www.pythoncraft.com/ import antigravity -- http://mail.python.org/mailman/listinfo/python-list