How to get multiple keys for values from a dictionary in Python

preview_player
Показать описание
This video contains two ways to get key values by the assigned values from a dictionary in python. I have covered this video as I didn't find good resources on that topic.
In case you have any questions please feel free to drop me a comment!

Video is also containing list comprehension approaches.

Video on list comprehension:

Video on dictionaries:

#Python #dictionary #key
Рекомендации по теме
Комментарии
Автор

duuuude I've been searching all over the internet for the past 4 hours and it's like... everyone had the same question I did, and then the answer they gave was some convoluted mass of code that wouldn't work even if I copied and pasted it in its entirety. You saved my day!... probably the whole week!

vikingghost
Автор

Hi, gutes Video!
Ne Frage habe ich aber, wie handhabe ich das, wenn meine Value eine Tuple ist? Mit der von dir gezeigten Methode sucht er mir nicht das nicht raus.

kaisdeljam
Автор

Thank you for this! You explained great. How could I do the same thing with a list of dicts but say that maybe Sara is in the grades list of dicts twice and I want to make sure I only append Sara 1 time in the new strivers list of dicts but update the value. I need to check if any keys from grades exists as keys in strivers. How could I do this check to achieve the below in strivers
grades = [{"student": "Sara", "grade": 100}, {"student": "Joe", "grade": 85}, {"student": "Vincent", "grades": 73}, {"student": "Martin", "grade": 68}, {"student": "Lisa", "grade": 97}, {"student": "Sara", "grade": 92}]

Expected result
strivers = [{"student": "Sara": "grade": 192}, {"student": "Lisa", "grade": 97}]

triceb
Автор

how to filter in dictionary for specific value

alaabadri
welcome to shbcf.ru