Python 2.7: Get only the row from a list where a specific cell matches a value (date in my case) -



Python 2.7: Get only the row from a list where a specific cell matches a value (date in my case) -

so want more "where , grouping clauses in sql" , code:

print "task1 : " open('suivi-ls.csv') csvfile: nb_saisi = 0 nb_ged = 0 reader = csv.reader(csvfile) row in reader: if not all(row): go on cell in row: if cell.split(";")[4] == "saisie": nb_saisi += 1 nb_ged += 1 print " data_1 : ",nb_ged print " data_2 : ",nb_saisi print "_________________________"

and ouput :

task1 : data_1 : data_2 :

knowing list after reading cvs file liks example:

date1 | data1 | data2 | data3 | date2 | data1_2 | data2_2 | data3_2 |

so want output like:

task1 : date1 data_1 : data_2 : date2 data_1_2 : data_2_2 :

i hope clear enough, please guys, can give me hint, head blocked. , thanks.

python-2.7

Comments

Popular posts from this blog

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

mediawiki - How do I insert tables inside infoboxes on Wikia pages? -

Local Service User Logged into Windows -