File writelines(list) : File Write « File « Python






File writelines(list)

 
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()

           
         
  








Related examples in the same category

1.Writing to FilesWriting to Files
2.File write(string)
3.Looping Over Characters with read Writing the Loop Differently
4.File Output
5.Writes the contents of string to the file