Alexnb wrote:
s = '--a href="/browse/brick"--brick--/a--'
s
'--a href="/browse/brick"--brick--/a--'
''.join('<%s>' % l if i % 2 == 1 else l for i, l in
enumerate(s.split('--')))
' /browse/brick brick '

I'm sorry, I don't think I was being clear. I replaced the <'s with -- so it
would post online w/o actually making a link. I just need to know how to get
the "brick" out.
1) if string really '--a href="/browse/brick"--brick--/a--'
>>> s.split('--', 3)[2]
brick
2) if string '<a href="/browse/brick">brick</a>'
>>> s.split('>', 1)[1].split('<')[0]
brick
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to