title: Using bs4 with python to parse a file, how do I get the text from an anchor tag?
body: <pre><code>&lt;HTML&gt;
  &lt;HEAD&gt;
  &lt;TITLE&gt;Generic Title&lt;/TITLE&gt;
  &lt;/HEAD&gt;
  &lt;a href=&quot;facebook.com&quot;&gt;Face book&lt;/a&gt;
  &lt;a href=&quot;google.com&quot;&gt;Google&lt;/a&gt;
  &lt;/HTML&gt;
  </code></pre>
  <p>how would I get the Face book and Google text from the anchor tag with bs4, every time I use <code>soup.find_all('a').text</code> it returns an attribute error
  this is the code I used</p>
  <pre><code>from bs4 import BeautifulSoup
  
  with open ('basic.html', 'r') as f:
      contents = f.read()
      soup = BeautifulSoup(contents, &quot;html.parser&quot;)
      
      l = soup.find_all('a').text
      print(l)
  </code></pre>