A list comprehension seems to be a good way to do this:
>>> [mydict[x] for x in mykeys]
[3, 1]
More Related Contents:
- How do I convert two lists into a dictionary?
- Convert [key1,val1,key2,val2] to a dict?
- Why can’t I use a list as a dict key in python?
- How can I get list of values from dict?
- Return a default value if a dictionary key is not available
- Grouping Python dictionary keys as a list and create a new dictionary with this list as a value
- Getting a list of values from a list of dicts
- How do I initialize a dictionary of empty lists in Python?
- Pandas DataFrame to List of Dictionaries
- Creating a list of dictionaries results in a list of copies of the same dictionary
- How can I make a dictionary from separate lists of keys and values?
- How to convert list of key-value tuples into dictionary?
- join two lists of dictionaries on a single key
- Check if value already exists within list of dictionaries?
- Convert list into a dictionary [duplicate]
- Combining Dictionaries Of Lists In Python
- switching keys and values in a dictionary in python [duplicate]
- Float values as dictionary key
- Most Pythonic Way to Build Dictionary From Single List
- Python – sum values in dictionary
- Python: get a dict from a list based on something inside the dict
- How can I get a random key-value pair from a dictionary?
- Changing one dict changes all dicts in a list of dicts [duplicate]
- Appending to list in Python dictionary [duplicate]
- Getting the difference (delta) between two lists of dictionaries
- Python: iterating over list vs over dict items efficiency
- Python – How to convert only numbers in a mixed list into float?
- How can I convert string values from a dictionary, into int/float datatypes?
- How to convert only numbers in a mixed list into float
- In what case would I use a tuple as a dictionary key? [closed]