Quiz Question 1 of 5
Given the code fileobj = open("logfile.txt", 'w+')
, what are the effects of this mode combination?
Choose the correct answer below:
-
A
The file
logfile.txt
will be opened for writing and reading, with any existing contents overwritten. -
B
The file
logfile.txt
will be opened for reading and writing, and if it exists, its contents will be preserved. -
C
The file
logfile.txt
will be opened in read mode by default, with an error if it does not exist. -
D
The file
logfile.txt
will be created if it does not exist, and if it exists, the file contents will be preserved.