-->

Exception Handling & Generate Functions

Question
CBSEENCO12011547

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

Solution

Difference between r+ and w+ is  given below:
r+ Opens a file for both reading and writing. The file pointer placed at the beginning of the file.
w+ Opens a file for both writing and reading. Overwrites the existing file if the file exists. If the file does not exist, creates a new file for reading and writing.

Some More Questions From Exception Handling & Generate Functions Chapter