To open files in append mode, specify 'a' as the mode(a=append). For example,
f = open('my_file.txt', 'a')
file_content = f.read()
f.write('Hello World')
f.close()Above code opens my_file.txt in append mode and appends the file to contain "Hello World" at the end.