A

Admin • 802.91K Points
Coach

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
  • Correct Answer - Option(C)
  • Views: 5
  • Filed under category Python
  • Hashtags:

Explanation by: Admin
The 'x' mode raises a FileExistsError if the file already exists.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.