Quiz Question 1 of 5
When opening a file using the open("data.txt", 'w')
function in Python, which of the following statements is true?
Choose the correct answer below:
-
A
The file
data.txt
will be created if it does not exist, and if it exists, its contents will be overwritten. -
B
The file
data.txt
will be opened for reading, and an error will occur if it does not exist. -
C
The file
data.txt
will be opened for appending, and the file will be created if it does not exist. -
D
The file
data.txt
will be opened in read mode by default, and its contents will be preserved.