[Tutor] Using if statement with csv file

Alan Gauld alan.gauld at btinternet.com
Tue Jan 27 19:20:00 CET 2015

On 27/01/15 13:04, Tammy Miller wrote:
> 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  		 	   		

Can you repost in plain text please?
As you can see the html version has come through as a
single long line with no clue to indentation etc.

Alan G
Author of the Learn to Program web site
Follow my photo-blog on Flickr at:

More information about the Tutor mailing list