I tried to parse a csv file to obtain the number of the columns and print out information from the column 2.
Below is my code and output:
>>>import csv
>>>with open('test.1.csv','r') as infile:
... text=csv.reader(infile,delimiter=',', quotechar='|')
... fields=len(list(text)[0])
... print fields
... for row in text:
... print row[1]
5
My question is why I only got number of the columns, but not the content of column 2?
Thank you very much for any inputs:)