+ 1

How to save a file in python?

13th Mar 2017, 3:37 PM
Karthick raja.s
1 Resposta
+ 8
f = open('sample.txt', 'w+') # creates a file 'sample.txt' and opens it for writing f.write("This is a sample file in Sololearn!") # writes to the file f.close() # closes and saves the file
13th Mar 2017, 5:14 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar