Beginner Python
Q38 / 101

How do you open a file for reading in Python?

Correct! Well done.

Incorrect.

The correct answer is B) open("file.txt")

B

Correct Answer

open("file.txt")

Explanation

open("file.txt") opens a file in read mode ("r") by default. Use with open("file.txt") as f: for safe resource management.

Progress
38/101