Read a specific column In a File:
To get the specific columns like only Item Name and profit for the “sampleS.csv” file.
Then you have to do the following:
import csv
#opening the csv file which is in different location with read mode
f=open(“c:\ \pyprg\ \chl3sample5.csv” , ’r’)
#reading the File with the help of csv.reader( )
readFile=csv.reader(f)
#printing the selected column for col in readFile :
print col[0],col[3]
f.close( )