Greetings.

Given the string s below and using only  python built-in capabilities,
I am trying to isolate the substring G132153. This string may have any
number of digits but the pieces around it will not change. I have
accomplished this with split but there must be a more elegant and
compact way to do this.


>>> s ='<a href="../active/Group_Detail.php?GroupID=G132153&SvcType=1&AType=V" 
>>> class="dvLink">G132153</a>'
>>> t = s.split('">')
>>> u = t[-1].split('<')
>>> v = u[0]
>>> v
'G132153'


Thanks,

jvh

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to