The differences between "w" and "a" modes are:
| "w" mode | "a" mode |
|---|---|
| The "w" mode in file opening is used for writing data to a file. | The "a" mode in file opening is used for appending data to a file. |
| If the file exists, Python will truncate existing data and over-write in the file. | If the file exists, the data in the file is retained and new data being written will be appended to the end of the file. |