1.

Give the program to add new row to the csv file?

Answer»

import csv

row= [‘6’ , ‘Sajini’Madurai’]

with open(‘student.csv’ , ‘a’) as CF: # append mode to add data at the end

writer= csv.writer(CF)

writer.writerow(row) # writerow( ) method write a 

single row of data in file

CF.close( )

Output

Roll No.NameCity
1.HariChennai
2.NirmalChennai
3.SaiTrichy
4.BooshanTrichy
5.ChaaruSalen
6.SajiniMadurai


Discussion

No Comment Found