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
More Related Contents:
- How to rid of spaces in line, python
- How to match a whole word with a regular expression?
- Python function global variables?
- How do I pass a string into subprocess.Popen (using the stdin argument)?
- How to preserve timezone when parsing date/time strings with strptime()?
- How do you check whether a number is divisible by another number?
- Pandas: rolling mean by time interval
- How do I run Python code from Sublime Text 2?
- Speeding up pandas.DataFrame.to_sql with fast_executemany of pyODBC
- pandas resample documentation
- How to override the [] operator in Python?
- Prepend a line to an existing file in Python
- TypeError: can’t use a string pattern on a bytes-like object in re.findall()
- Python Regex instantly replace groups
- Access item in a list of lists
- How to implement a pythonic equivalent of tail -F?
- Hitting Maximum Recursion Depth Using Pickle / cPickle
- Python command line input in a process
- Fail during installation of Pillow (Python module) in Linux
- In Python script, how do I set PYTHONPATH?
- Python: Checking if a ‘Dictionary’ is empty doesn’t seem to work
- How to plot data from multiple two column text files with legends in Matplotlib?
- How can I get Selenium Web Driver to wait for an element to be accessible, not just present?
- When scattering Flask Models, RuntimeError: ‘application not registered on db’ was raised
- Adding a string to a list using augmented assignment
- Python pandas integer YYYYMMDD to datetime
- Difference between consecutive elements in list [duplicate]
- Updating context data in FormView form_valid method?
- Python equivalent of npm or rubygems?
- raise statement on a conditional expression