Whats the difference between these two modes?
What are the scenarios in which they behave diffrently?
Difference between read-write mode and difference between write-read mode
Hey @aditrisriv, the difference between them is as follows :
Both r+ and w+ opens files for read / write.
But w+ creates file if it doesn’t exist. On the other hand r+ raises an error.
f = open("test", "w+") creates "test" if it doesn't exist.
f = open("test", "r+") raises FileNotFound exception if 'test' doesn't exist.
However both the modes can be used depending on the use case.
I hope this helps !
Please mark the doubt as resolved in your doubts section !
Happy Learning !