Differentiate between file modes r+ and w+ with respect to Python.

 

Answer:

r+

w+

Opens a file for both reading and writing

Opens a file for both writing and reading. 

The file pointer will be at the beginning of the file. 

Overwrites the file if the file exists

If the file does not exist , creates a new file for reading and writing. 

Go Ad-free
Davneet Singh's photo - Co-founder, Teachoo

Made by

Davneet Singh

Davneet Singh has done his B.Tech from Indian Institute of Technology, Kanpur. He has been teaching from the past 14 years. He provides courses for Maths, Science and Computer Science at Teachoo