Friday, 15 February 2013

python - searching a csv and printing a line -



python - searching a csv and printing a line -

trying create train booking system. having problem searching csv , printing line.

the user has there id number,and csv is set out like

this have far:

you matching entire line against id. need split out first field , check that:

def buyseat(): id = raw_input("please come in id") line in open("customers.csv"): if line.split(',')[0] == id: print line else: print "sorry cant find you"

python csv

No comments:

Post a Comment