- How to modify existing, unpushed commit messages?How to modify existing, unpushed commit messages?
- What does the "yield" keyword do in Python?What does the "yield" keyword do in Python?
- How to check whether a string contains a substring in JavaScript?How to check whether a string contains a substring in JavaScript?
For what it's worth, as a dabbling Python programmer myself, I would not have been able to answer the question you linked tothe question you linked to off the top of my head.* Sure, I could've looked it up in the docs or Googled for it — but typically, the most useful Google results for such searches tend to be SO questions just like this!
- Get list of values for list of keysGet list of values for list of keys
- Dictionary keys match on list; get key/value pairDictionary keys match on list; get key/value pair
- Collecting values from a Python dictionary with list of keysCollecting values from a Python dictionary with list of keys
- Get values in Python dictionary from list of keysGet values in Python dictionary from list of keys
- Is it possible to take an ordered "slice" of a dictionary in Python based on a list of keys?Is it possible to take an ordered "slice" of a dictionary in Python based on a list of keys?
- How to get dictionary values having its keys as a listHow to get dictionary values having its keys as a list
- Sort of dictionary values from keys in an ordered listSort of dictionary values from keys in an ordered list
- Sorting dictionary keys by values in a list?Sorting dictionary keys by values in a list?
Not all of those are exact duplicates, but they're all variants of the same basic question, and the all have the same general answer ("use list comprehension"; although there are some rather interesting alternatives buried in some of the answers, like using operator.itemgetter as suggested herehere). Ideally, most of those should probably be closed as duplicates of a single canonical question, possibly this onethis one (first in the list above), but even as they are, they're all still useful sources of information.
*) In Perl, which I'm more familiar with, I'd use what's called a "hash slice" — essentially, indexing the dictionary with a list of keys, and getting a list of values. But while Python also has something called "slicing", it's not really the same thing, so that obvious (to me) approach won't work in Python. That said, Googling for "python dictionary slice" is how I found thisthis dupe, so clearly I'm not the only one with this terminology issue.