Differentiate between w and w+ file modes in Python. What happens if the file does not exist in each mode?
Answer:
Answer by student
The w mode is used to open a file for writing only . It will overwrite the existing file if it exists, or create a new file if it does not exist.
The w+ mode is used to open a file for both writing and reading . It will also overwrite the existing file if it exists, or create a new file if it does not exist.
Detailed answer by teachoo
The rest of the post is locked. Join Teachoo Black to see the full post.