<br><br><div class="gmail_quote">On Wed, Apr 1, 2009 at 8:25 AM, Gabriel Rossetti <span dir="ltr"><<a href="mailto:gabriel.rossetti@arimaz.com">gabriel.rossetti@arimaz.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hello everyone,<br>
<br>
I am using beautiful soup to parse some HTML and I came across something strange.<br>
Here is an illustration:<br>
<br>
>>> soup = BeautifulSoup(u'<div class="text">hello ça boume<br /></div')<br>
>>> soup<br>
<div class="text">hello ça boume<br /></div><br>
>>> soup.find("div", "text")<br>
<div class="text">hello ça boume<br /></div><br>
>>> soup.find("div", "text").string<br>
>>> soup.find("div", "text").next<br>
u'hello \xe7a boume'<br>
<br>
why does soup.find("div", "text").string not give me the string? Is it because there is a <br/>?</blockquote><div><br>IIRC, yes it is, and there's not much you can do about it other than  use .next.string or .contents[0]  or stripping out brs. See <a href="http://www.crummy.com/software/BeautifulSoup/documentation.html">http://www.crummy.com/software/BeautifulSoup/documentation.html</a> , particularly the "Removing Elements" and "string" sections.<br>
</div></div><br>