[ACCEPTED]-Append a text to file in Python-io
Accepted answer
Use mode a
instead of w
to append to the file:
with open('text.txt', 'a', encoding='utf-8') as file:
file.write('Spam and eggs!')
0
Source:
stackoverflow.com
More Related questions
Cookie Warning
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.