list_t = ['a','b','a','c','d','b']
dictionary = {'a':1,'b':2,'c':3,'d':4}
lis=[]
for i in list_t:
for key in dictionary:
if (i==key):
lis.append(dictionary[i])
print lis
1
solved Replacing List items with Dictionary Items?
list_t = ['a','b','a','c','d','b']
dictionary = {'a':1,'b':2,'c':3,'d':4}
lis=[]
for i in list_t:
for key in dictionary:
if (i==key):
lis.append(dictionary[i])
print lis
1
solved Replacing List items with Dictionary Items?