0
Hi here is Vidhi. Can you please tell me how to save a file in python
Save a file
4 Answers
+ 2
Please check the lessons about file handling, here.
https://www.sololearn.com/learn/JUMP_LINK__&&__Python__&&__JUMP_LINK/2447/
+ 2
vinita sarda
fi = open("new.txt", "w")
fi.write("hello")
fi.close()
+ 2
Here is a sample:
https://code.sololearn.com/cM58bA10GCOc/?ref=app
+ 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.