I want to retrieve the value of DP from the following list 'seg'
import re
seg = ['AC=2', 'AF=1.00', 'AN=2', 'DB', 'DP=6', 'FS=0.000',
'MLEAC=2', 'MLEAF=1.00', 'MQ=31.55', 'MQ0=0', 'QD=31.64']
for i in seg:
name = re.compile(r'DP=(.*)')
mo = name.search(i)
if mo:
print "True",mo
else:
print "no"
This gives me the output as follows:
no
no
no
no
True <_sre.SRE_Match object at 0x00000000025DDCD8>
no
no
no
no
no
no
The match is found but why is not giving me the DP value? Pls help me I am new to regex