[Tutor] Menus with dictionaries or lists?
Arthur
pylinuxian at gmail.com
Mon Apr 28 22:43:59 CEST 2008
#!/usr/bin/python
#
import csv
file = csv.reader(open("file.txt", "r"),delimiter=';')
for row in file:
# now each row is a list
#print row
#print row[0]
cntry=row[0]
row[0]={}
row[0]['country']=row[1]
row[0]['county']=row[2]
print 'for country',cntry, row[0]
this is simple enough i guess, use your imagination to finish it up ...
to take input from user at cli you will use : raw_input("Enter Country")
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20080428/e0057b95/attachment.htm>
More information about the Tutor
mailing list