Is it possible to get Value out of tuple:
TUPLE = (
('P', 'Shtg1'),
('R', u'Shtg2'),
('D', 'Shtg3'),
)
by calling STR key like P
Python says that only int can be used for this type of ‘query’
I can’t use loop (too much overhead…)
Thank you!
The canonical data structure for this type of queries is a dictionary:
If you use a tuple, there is no way to avoid looping (either explicit or implicit).