0

Hi here is Vidhi. Can you please tell me how to save a file in python

Save a file

16th May 2020, 8:26 AM
vinita sarda
vinita sarda - avatar
4 Answers
+ 2
Please check the lessons about file handling, here. https://www.sololearn.com/learn/JUMP_LINK__&&__Python__&&__JUMP_LINK/2447/
16th May 2020, 8:34 AM
Tibor Santa
Tibor Santa - avatar
+ 2
vinita sarda fi = open("new.txt", "w") fi.write("hello") fi.close()
16th May 2020, 8:37 AM
Petr
16th May 2020, 8:50 AM
Paul
Paul - avatar
+ 1
Simply use... with open ("vinita.txt", "w") as vini : vini.write("Vinita Sarda") # you don't need to close file if you used this way. # try more on this... Vinita.txt is filename "w" means writing mode vini means a nickname for opened file vini.write() is a function to write in the file.
16th May 2020, 9:10 AM
Manish
Manish - avatar