Adding column to CSV Dictreader

32

01
02
03
04
05
06
07
08
09
10
# importing DictReader class  from csv module
from csv import DictReader
 
# opening csv file named as airtravel.csv
with open('airtravel.csv','r') as file:
    reader = DictReader(file,fieldnames=['Month','1958','1959','1960'])
    print("Data:")
    # printing each row of table as dictionary 
    for row in reader:
        print(row)

Comments

Submit
0 Comments