Vidyalelo
Python · Q19

Files Handling in Python

Programming · Python · question 19

Q19

What is the output of the following code:with open('data.txt', 'w') as file: file.write('Hello, world!')

A.
The file data.txt will contain Hello, world!
B.
An error will occur
C.
The file data.txt will be empty
Answer
D.
Hello, world!

Answer: Option C

Solution

Answer: Option C
No explanation is given for this question Let's Discuss on Board