[Python] Tuple value by key

Discussão em 'Python' iniciado por Stack, Agosto 27, 2025.

  1. Stack

    Stack Membro Participativo

    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!

    Continue reading...

Compartilhe esta Página