πŸ“Š Python
Q. What is the correct way to open a file for reading in Python?
  • (A) open('file.txt', 'r')
  • (B) open('file.txt', 'w')
  • (C) open('file.txt', 'rw')
  • (D) open('file.txt')
πŸ’¬ Discuss
βœ… Correct Answer: (A) open('file.txt', 'r')

Explanation: The `'r'` mode is used to open a file in read-only mode. `open('file.txt')` also defaults to read mode.

Explanation by: Rati Dubey
The `'r'` mode is used to open a file in read-only mode. `open('file.txt')` also defaults to read mode.

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
38
Total Visits
πŸ“½οΈ
4 mo ago
Published
πŸŽ–οΈ
Rati Dubey
Publisher
πŸ“ˆ
81%
Success Rate