+ 2

how to add content to already existed file in runtime.i mean input

25th Sep 2016, 2:31 PM
harish tati
3 Respuestas
+ 6
if you want to add something at the end of the file, you have to open it with "a" not "w". f.open("file.txt","a")
8th Oct 2016, 1:46 PM
Paolo Di Paolo
Paolo Di Paolo - avatar
0
from tkinter import simpledialog as in another option file=open("/home/user/Desktop/file.txt","a") ___this is if you want to add more information into txt file___"a"__ now text=in.askstring("name","input text") file.write(text) file.close() this is te way to ask in a message box
12th Jan 2017, 5:43 PM
Melito M Andres
Melito M Andres - avatar
- 2
Here's a simple program to write into a file import sys fopen=open("file.txt","w") #full path of your file if it is not in the folder where your program is. string1=input("Enter input") fopen.write(string) fopen.close()
26th Sep 2016, 9:03 PM
Susan Ghosh