Python – How to append to a file

appendfilepython

How do you append to the file instead of overwriting it? Is there a special function that appends to the file?

Best Answer

with open("test.txt", "a") as myfile:
    myfile.write("appended text")