A recipe is * open your file for reading: f = open('filename.txt', 'r') * read all lines in a list: content = f.readlines() * close the file: f.close() * set the third element in the list to something else: content[2] = 'Blahdiblah' * re-open the file for writing: f = open('filename.txt', 'w') * write the list to the file: f.writelines(content) * close the file: f.close()
-- http://mail.python.org/mailman/listinfo/python-list