a = ['BVI Ltd','sdfdsf','df'];
index = dict((y,x) for x,y in enumerate(a))
try:
a_index = index["BVI Ltd"]
print a_index
except KeyError:
print "Not found"
else:
print "found"
index = dict((y,x) for x,y in enumerate(a))
try:
a_index = index["BVI Ltd"]
print a_index
except KeyError:
print "Not found"
else:
print "found"
No comments:
Post a Comment