Source Code:
(back to article)
def get_key(wörterbuch, wert): return next((k for k, v in wörterbuch.items() if v == wert), None) mein_dict = {'a': 1, 'b': 2, 'c': 3} print(get_key(mein_dict, 2)) # Ausgabe: 'b'
Result:
Report an issue