CBSE Class 12 Computer Science Question 5 of 51

Data File Handling — Question 1

Back to all questions
1
Question

Question 1

What is the difference between "w" and "a" modes?

Answer

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.
Get the Bright Tutorials app Stuck on a question? Ask Bright Buddy — your AI tutor — for step-by-step help in the app.