BeautifulSoup problem

placid Bulkan at gmail.com
Fri Oct 20 12:38:57 CEST 2006


Marc 'BlackJack' Rintsch wrote:
> In <1161330895.808308.292910 at i42g2000cwa.googlegroups.com>, placid wrote:
>
> > Hi all,
> >
> > Just wondering if anyone knows how to get the text between the tags of
> > the following Tag object?
> >
> > <span class="nametext">Hello</span>
>
> Are you looking for a way to search for tag *and* attributes?  What about
> this::
>
>   In [12]: soup.find('span', {'class': 'nametext'}).contents
>   Out[12]: [u'Hello']

No this wasnt what i was looking for because i didnt know you could do
this. Thanks for that, this is better.

Cheers




More information about the Python-list mailing list