Q. What will open('data.txt', 'x') do if data.txt already exists?

  • (A) Open the file for reading
  • (B) Append to the file
  • (C) Raise an error
  • (D) Overwrite the file
πŸ’¬ Discuss
βœ… Correct Answer: (C) Raise an error
Explanation: The 'x' mode raises a FileExistsError if the file already exists.
Explanation by: Mr. Dubey
The 'x' mode raises a FileExistsError if the file already exists.

πŸ’¬ Discussion


πŸ“Š Question Analytics

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