+2 votes
in Programming Languages by (59.4k points)
I want to open a file in append mode so that I can add records to this file in different functions present in my program. How to append new records to a file instead of rewriting?

1 Answer

0 votes
by (233k points)

You can use 'a' in the open() function to open a file in append mode. Check the below example.

with open("myfile", "a") as fl:

    fl.write("your data")

Related questions