Check sibling questions

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. 

  1. Computer Science - Class 12
  2. Chapter 2 - File Handling in Python

About the Author

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