[Tutor] Using if statement with csv file

dw bw_dw at fastmail.fm
Tue Jan 27 23:40:50 CET 2015

Hi Tammy,
I wonder how big your csv file is?
I have ever read a small csv file into one variable.
Even a csv file with 100 rows.
And then split it into identified fields from there.
I look at the csv file with Notepad++ to see if the data rows end with a
\r or a \n.
I then split that into a list and each row is an element in the list.
I can then split each row by the comma delimiter, to resolve down to
each field.
Just an idea.

I have a csv file. I would like to create a filter or if statement on a
column but it is not producing the right results. It displays
everythingHere is the example:import csvwith open('test.csv') as
csvfile:    reader = csv.DictReader(csvfile)for row in reader:    if
row['Absent'] > 10      print rowI just want the column Absent to show
me all of the numbers that are greater than 10.  It gives me all the
results.  I am not sure what to do.Thank you, Tammy    
 Bw_dw at fastmail.net

More information about the Tutor mailing list