24 Sep 2022

How to Write to Text File in Python
Python Write Text File
Mode | Description |
---|---|
w |
Open a text file for writing. If the file exists, the function will remove all the contents as soon as you open it. If the file doesn’t exist, the function creates a new file. |
a |
Open a text file for appending text. If the file exists, the function append contents at the end of the file. |
+ |
Open a text file for updating (both reading & writing). |