Python Forum

Full Version: Update any file
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
How to update any txt file
like I want to add more lines in the text file but don't want to overwrite

with open('Text.txt', "w") as file:
    file.write('This is 2 message.')
instead of mode 'w', use mode 'a' (append)