I'm trying to get the 'FOO' string but the problem is that inner 'P'
tag there is another tag, 'a'. So:
from BeautifulSoup import BeautifulSoup
s = 'td width=88% valign=TOP p class=contentBodyFOO a
name=f/a /p/td'
tree = BeautifulSoup(s)
print tree.first('p')
p class=contentBodyFOO a
In [EMAIL PROTECTED], GinTon wrote:
I'm trying to get the 'FOO' string but the problem is that inner 'P'
tag there is another tag, 'a'. So:
from BeautifulSoup import BeautifulSoup
s = 'td width=88% valign=TOP p class=contentBodyFOO a
name=f/a /p/td'
tree = BeautifulSoup(s)
print
Marc 'BlackJack' Rintsch wrote:
In [53]: print tree.first('p').contents[0]
FOO
Thanks! I was going to crazy with this.
--
http://mail.python.org/mailman/listinfo/python-list
Quick-n-dirty way:
After you get your whole p string: p class=contentBodyFOO a
name=f/a /p
Remove any tags delimited by '' and '' with a regex. In your short
example you _don't_ show that there might be something between the a
and /a tags so I assume there won't be anything or if there would be