πŸ“Š Python
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

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