I have a list that looks like this:
mylist = [
'Th2 2w, total RNA (linc-sh36)',
'SP CD8, total RNA (replicate 1)',
'DN 2, total RNA (replicate 2)']
What I want to do is to keep entries in that list that match another list:
ctlist = ['DN 1', 'DN 2', 'DN 3', 'DN 4', \
'DP 1', 'DP 2', 'tTreg', 'CD8', 'CD4', 'iTreg']
So the final output is to produce this:
SP CD8, total RNA (replicate 1)
DN 2, total RNA (replicate 2)
I tried this but produce no result:
import re
for mem in mylist:
for ct in ctlist:
regex = re.compile(ct)
match = regex.match(mem)
if match:
print mem
What's the right way to do it?