I am encountering some weird things here.I am using python's csv module to process csv file. The example code is below
import csv
f = open('file.csv','r')
for i in csv.reader(f):
print i
This prints out all rows as lists and works just fine.And then when I want to do another thing like
for i in csv.DictReader(f):
print i['header']
Think this should print all the data with the header called 'header'.It failed.Then I tried a lot.I found I need to run the open file function again each time I run some csv method.It seems redundant to me.Think i might miss some steps.