Write lines : writelines « File « Python Tutorial






f = open(r'c:\text\somefile.txt')
lines = f.readlines()
f.close()
lines[1] = "isn't a\n"
f = open(r'c:\text\somefile.txt', 'w')
f.writelines(lines)
f.close()








12.17.writelines
12.17.1.Write lines
12.17.2.Write a list to a file