A

Admin • 832.27K Points
Coach

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

Explanation by: Admin

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

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.