0

How to write in the file 2,3 etc. strings?

2nd Jul 2017, 12:43 PM
Timka
Timka - avatar
3 Answers
0
What file, is the file the python file? Is it a file you're opening? I'm gonna just guess you mean write a text file, since your question is ambiguous. Here's a basic example: file = open("test.txt" "a") file.write("0,1,2,3,4,5,6,7,8,9" + "\n") file.close()
2nd Jul 2017, 2:49 PM
Sapphire
0
thank you , it is helpful
2nd Jul 2017, 3:12 PM
Timka
Timka - avatar
0
if you use : with open('text.txt,'w') as file; instead of: file=open function you will not need to close file; with open closes file by itself
4th Jul 2017, 12:00 AM
Maid Rondic
Maid Rondic - avatar