Oct-02-2018, 10:15 PM
I'm new to Python. If I have a list indicate the order for a new list with the key in a dictionary, how could I get the new list with the values in the dictionary.
For instance:
l = ['a','b','a','c','b']
D = {'a':[3,2],'b':[4,5],'c':[1]}
How can I get a new list as:
L = [3,4,2,1,5]
A lot of thanks!
For instance:
l = ['a','b','a','c','b']
D = {'a':[3,2],'b':[4,5],'c':[1]}
How can I get a new list as:
L = [3,4,2,1,5]
A lot of thanks!