title: Extracting text in span element using BeautifulSoup
body: <p>So this is the thing, I'm trying to extract some data from the SEC database using BeautifulSoup, I'm literally new at python but I been able to write the following code.</p>
  
  <p>The idea is to use a list of quote symbols in a .txt and extract "the CIK" number of each company for further use.</p>
  
  <pre><code>import requests
  from bs4 import BeautifulSoup
  list_path = r"C:\Users\User1\Downloads\Quote list.txt"
  
  with open(list_path, "r") as flist:
      for quote in flist:
          quote = quote.replace("\n", "")
          url = (r"https://www.sec.gov/cgi-bin/browse-edgar?action=getcompany&amp;CIK=" + quote + 
          r"&amp;type=10&amp;dateb=&amp;owner=exclude&amp;count=100")
          source_code = requests.get(url)
          plain_text = source_code.text
          soup = BeautifulSoup(plain_text, "html.parser")
          for company_info in soup.find_all("span", {"class" :"companyName"}):
              cik_code = company_info.string
              print(cik_code)
  </code></pre>
  
  <p>So far, the code above print "none" values for the string 'cik_code'. The element in html is the following:</p>
  
  <pre><code>&lt;span class="companyName dm-selected dm-test"&gt;
        AAON INC 
        &lt;acronym title="Central Index Key"&gt;CIK&lt;/acronym&gt;
        #: 
        &lt;a href="/cgi-bin/browse-edgar?
        action=getcompany&amp;amp;CIK=0000824142&amp;amp;owner=exclude&amp;amp;count=100" 
        class=""&gt;0000824142 (see all company filings)&lt;/a&gt;
  &lt;/span&gt;
  </code></pre>
  
  <p>The cik code is the last number: 0000824142, just before "(see all company filings)"</p>
  
  <p>How can I set that number to the string cik_code</p>