Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Adding column to CSV Dictreader

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)
Source by www.pythonpool.com #
 
PREVIOUS NEXT
Tagged: #Adding #column #CSV #Dictreader
ADD COMMENT
Topic
Name
9+1 =