Which of the following statements about Python file opening modes is correct? I. r is used for reading. II. w is used for writing and truncating. III. a is used for appending.

Options

  • A. Only I
  • B. Only II
  • C. Statements I, II and III
  • D. More than one of the above
  • E. None of the above

Correct Answer (Detailed Explanation is Below)

C. Statements I, II and III

Detailed Explanation

All three statements are correct: r reads, w writes and truncates, and a appends to a file.