title: BeautifulSoup, extracting strings within HTML tags, ResultSet objects
body: <p>I am confused exactly how I can use the ResultSet object with BeautifulSoup, i.e. <code>bs4.element.ResultSet</code>.</p>
  
  <p>After using <code>find_all()</code>, how can one extract text? </p>
  
  <p>Example:</p>
  
  <p>In the <code>bs4</code> documentation, the HTML document <code>html_doc</code> looks like: </p>
  
  <pre><code>&lt;p class="story"&gt;
      Once upon a time there were three little sisters; and their names were
      &lt;a class="sister" href="http://example.com/elsie" id="link1"&gt;
       Elsie
      &lt;/a&gt;
      ,
      &lt;a class="sister" href="http://example.com/lacie" id="link2"&gt;
       Lacie
      &lt;/a&gt;
      and
      &lt;a class="sister" href="http://example.com/tillie" id="link2"&gt;
       Tillie
      &lt;/a&gt;
      ; and they lived at the bottom of a well.
     &lt;/p&gt;
  </code></pre>
  
  <p>One begins by creating the <code>soup</code> and finding all <code>href</code>, </p>
  
  <pre><code>from bs4 import BeautifulSoup
  soup = BeautifulSoup(html_doc, 'html.parser')
  soup.find_all('a')
  </code></pre>
  
  <p>which outputs</p>
  
  <pre><code> [&lt;a class="sister" href="http://example.com/elsie" id="link1"&gt;Elsie&lt;/a&gt;, 
    &lt;a class="sister" href="http://example.com/lacie" id="link2"&gt;Lacie&lt;/a&gt;,
    &lt;a class="sister" href="http://example.com/tillie" id="link3"&gt;Tillie&lt;/a&gt;]
  </code></pre>
  
  <p>We could also do</p>
  
  <pre><code>for link in soup.find_all('a'):
      print(link.get('href'))
  </code></pre>
  
  <p>which outputs</p>
  
  <pre><code>http://example.com/elsie
  http://example.com/lacie
  http://example.com/tillie
  </code></pre>
  
  <p>I would like to get <em>only</em> the text from the <code>class_="sister"</code>, i.e. </p>
  
  <pre><code>Elsie
  Lacie
  Tillie
  </code></pre>
  
  <p>One could try </p>
  
  <pre><code>for link in soup.find_all('a'):
      print(link.get_text())
  </code></pre>
  
  <p>but this results in an error:</p>
  
  <pre><code>AttributeError: 'ResultSet' object has no attribute 'get_text'
  </code></pre>