##### the first way
import unicodecsv
def read_csv(filename):
with open('enrollments.csv','rb') as f :
reader=unicodecsv.DictReader(f)
enrollments=list(reader)
with open('daily_engagement.csv','rb') as f:
reader=unicodecsv.DictReader(f)
daily_engagement=list(reader)
with open('project_submissions.csv','rb') as f:
reader=unicodecsv.DictReader(f)
project_submissions=list(reader)
print enrollment[0]
print daily_engagement[0]
print project_submissions[0]
########the second way
import unicodecsv
def read_csv(filename):
with open(filename,'rb') as f:
reader=unicodecsv.DictReader(f)
return list(reader)
enrollments=read_csv(enrollments_filename)
daily_engagement=read_csv(engagement_filename)
project_submissions=read_csv(submission_filename)
print enrollments[0]
print daily_engagement[0]
print project_submission[0]
######unicodecsv works exactly the same as csv,but it comes with Anaconda and has support for unicode.The csv documentation page is still the
best way to learn how to use the unicodecsv library,since the two libraries work exactly the same way.