How do you append to a file in Python?

In Python, you can open a file with read, write or append mode using “r”, “w”, or “a” parameters as shown in the below examples –