Answers for "write on a file"

73

python write to file

file = open(“testfile.txt”,”w”) 
 
file.write(“Hello World”) 
file.write(“This is our new text file”) 
file.write(“and this is another line.”) 
file.write(“Why? Because we can.”) 
 
file.close() 
Posted by: Guest on December-09-2019
0

write to file in p

f = open("demofile2.txt", "a")
f.write("Now the file has more content!")
f.close()
Posted by: Guest on June-17-2021

Python Answers by Framework

Browse Popular Code Answers by Language