title: How to select only this text node using BeautifulSoup and Python?
body: <p>I have this html stucture :</p>
  
  <pre><code>&lt;div class="foo"&gt;
      &lt;h3&gt;Title&lt;/h3&gt;
      &lt;br&gt;Some text I want to retrieve. &lt;br&gt;&lt;br&gt; This text too.
      &lt;br&gt; (numbers and position of "br" tag indetermined) And this one too.
      &lt;div class="subfoo"&gt;Some other text I don't want.&lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>In my python script, I have written :</p>
  
  <pre><code>exampleSoup = bs4.BeautifulSoup(res.text, "html.parser")
  elems = exampleSoup.select('.foo')
  print(elems[0].getText())
  </code></pre>
  
  <p>As expected I get the whole text : </p>
  
  <pre><code>Title
  Some text I want to retrieve.
  Some other text I don't want.
  </code></pre>
  
  <p>How to get only the string in the div that has no tag around ie :<em>"Some text I want to retrieve. This text too. And this one too."</em> ?
  Thanks for the help.</p>