File write(string) : File Write « File « Python






File write(string)

 
f = open(r'c:\text\somefile.txt', 'w')
f.write('this\nis no\nhaiku')
f.close()

           
         
  








Related examples in the same category

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