BeautifulSoup problem

Marc 'BlackJack' Rintsch bj_666 at gmx.net
Fri Oct 20 04:45:05 EDT 2006


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']

Ciao,
	Marc 'BlackJack' Rintsch



More information about the Python-list mailing list