Append to a File in python

Python Program to Append to a File, What is Append in Python, Why We Use Append in Python

#Append to a File in python

#content of myfile.txt is
# open the file with access mode "a"
with open("myfile.txt", "a") as f:
   f.write("new text")


The content of the file after appending a text to it is:

welcomenew text

About The Author

Leave a Reply