CBSE Class 12 Computer Science Question 49 of 145

File Handling — Question 10

Back to all questions
10
Question

Question 10

Which of the following is not a correct Python statement to open a text file "Notes.txt" to write content into it ?

  1. F = open('Notes.txt', 'w')
  2. F = open('Notes.txt., 'a')
  3. F = open('Notes.txt', 'A')
  4. F = open('Notes.txt', 'w+')
Answer

F = open('Notes.txt', 'A')

ReasonF = open('Notes.txt', 'A'), in this statement mode should be written in small letter 'a'. So the correct statement would be F = open('Notes.txt', 'a').