Stay With us
3 new comments

beginner
new

Help & Settings
About
Help
Tips

Write text to a file in python without removing previous content.

i have written a programme in python that write two a file. But i want to write text to a file the previous text is removed and new text is written in the file. I want to write text file without removing the previous text in file. Here is my programme.

text = "this is new text"
WriteText = ('previousFile.txt','w')
WriteText.write(text)
WriteText.close()

Now i want to write new text without removing old text to file.

(0) Replies

Please login or register to Comment or Answer