CBSE Class 12 Computer Science
Question 118 of 145
File Handling — Question 14
Back to all questionsimport csv
f = open('attendees1.csv') #error
csv_f = csv.writer(f)To use the csv.writer() function, the file should be opened in write mode ('w'). The corrected code is :
import csv
f = open('attendees1.csv', 'w')
csv_f = csv.writer(f)