parsing - Going back in a CSV file in python -


i'm trying parse csv file like :

name, init tim keller, tk nick fill, nk 

and here's want, enter tk , give him hello tim keller !

the issue have can't fallback in csv file (well.. don't know how it..)

here's made :

with open('datas.csv', 'rb') csvfile:         spamreader = csv.reader(csvfile, delimiter=';', quotechar='|')         row in spamreader:                 columns in row:                         if columns == args[i]:                                 print "hello ", columns, " !" 

well code if user enter tk print hello tk !

i tried columns-1 seems not it..

thanks !

            columns in row: 

is not necessary. if row in spamreader, already have both parts, index row: row[0] name, row[1] nickname.

see fine manual!


Comments

Popular posts from this blog

Email notification in google apps script -

c++ - Difference between pre and post decrement in recursive function argument -

javascript - IE11 incompatibility with jQuery's 'readonly'? -