Sunday, July 29, 2018

How do you append to a file in Python?




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


Answer



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

No comments:

Post a Comment

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...