simple question about dictionaries

skazhy skazhy at gmail.com
Mon Jul 21 13:35:46 CEST 2008


hi, i am new to python, so i've a really simple question about
dictionaries.
if i have a dictionary and I make have an input after it (to input
numbers) can i get the key of value that was in input?

somehting like this:
dict = { "key1"=100,"key2"=200,"key3"=300}
a = input()
print 'the key of inputted value is', dict['a']

this syntax of course is wrong, but i hope you got the point..

thanks in advance!




More information about the Python-list mailing list