python - Row count in a csv file -


i making stupid mistake, can't find is. want count number of lines in csv file. wrote this, , isn't working: have row_count = 0 while should 400. cheers.

f = open(adresse,"r") reader = csv.reader(f,delimiter = ",") data = [l l in reader] row_count = sum(1 row in reader)  print row_count 

with open(adresse,"r") f:     reader = csv.reader(f,delimiter = ",")     data = list(reader)     row_count = len(data) 

you trying read file twice, when file pointer has reached end of file after saving data list.


Comments

Popular posts from this blog

java - Unable to make sub reports with Jasper -

Save and close a word document by giving a name in R -

How can I utilize Yahoo Weather API in android -