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="contentBody">FOO <a >> name="f"></a> </p></td>' >> tree = BeautifulSoup(s) > >> print tree.first('p') > <p class="contentBody">FOO <a name="f"></a> </p> > > So if I run 'print tree.first('p').string' to get the 'FOO' string it > shows Null value because it's the 'a' tag: > >> print tree.first('p').string > Null > > Any solution?
In [53]: print tree.first('p').contents[0] FOO Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list