Issue
How do you append to the file instead of overwriting it? Is there a special function that appends to the file?
Solution
This can be achieved by setting the mode in open()
to "a"
(append) instead of "w"
(write). See the documentation op open()
for all available modes.
with open("test.txt", "a") as myfile:
myfile.write("appended text")
Answered By - Petter Answer Checked By - Gilberto Lyons (PHPFixing Admin)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.