πŸ“Š Python
Q. Which of the following opens a file for writing?
  • (A) open('file.txt', 'w')
  • (B) open('file.txt', 'r')
  • (C) open('file.txt', 'a')
  • (D) open('file.txt')
πŸ’¬ Discuss
βœ… Correct Answer: (A) open('file.txt', 'w')

Explanation: `'w'` mode opens a file for writing, truncating it first.

Explanation by: Mr. Dubey
`'w'` mode opens a file for writing, truncating it first.

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
43
Total Visits
πŸ“½οΈ
8 mo ago
Published
πŸŽ–οΈ
Mr. Dubey
Publisher
πŸ“ˆ
80%
Success Rate