title: How to extract a specific string inside a tag with BeautifulSoup
body: <p>I am able to parse a section of a website, however I want to further extract a specific string from the section with Python/BeautifulSoup</p>
  
  <p><strong>My code:</strong></p>
  
  <pre><code>    section = soup.find("div", {"class": "listing-col col-sm-16 col-md-12 col-lg-13 col"})
  
      for span in section.select('div.btn-group'):
          print(span)
          exit() # just print one and exit
  </code></pre>
  
  <p><strong>Output:</strong></p>
  
  <pre><code>&lt;div class="btn-group" role="group"&gt;
  &lt;shortlist-directive data-shortlist-id="10981410" ng-controller="ShortlistController" ng-init="setCurrentListingIdSrp('10981410'); setGAEventDataSrp({&amp;quot;ss_cg_listing_id&amp;quot;:10981410,&amp;quot;listingid&amp;quot;:10981410,&amp;quot;make&amp;quot;:&amp;quot;Audi&amp;quot;,&amp;quot;model&amp;quot;:&amp;quot;TT&amp;quot;,&amp;quot;transmission&amp;quot;:&amp;quot;Automatic&amp;quot;,&amp;quot;body_type&amp;quot;:&amp;quot;Coupe&amp;quot;,&amp;quot;location&amp;quot;:&amp;quot;Maddington, WA&amp;quot;,&amp;quot;Kms&amp;quot;:&amp;quot;54,570 km&amp;quot;,&amp;quot;featured&amp;quot;:&amp;quot;No&amp;quot;,&amp;quot;seller_type&amp;quot;:&amp;quot;USED Dealer ad&amp;quot;,&amp;quot;ss_cg_products&amp;quot;:&amp;quot;&amp;quot;});"&gt;&lt;/shortlist-directive&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p><strong>Question:</strong></p>
  
  <p>From the <em>output</em> I want to extract <code>10981410</code> from <code>data-shortlist-id="10981410"</code> inside of <code>shortlist-directive</code>. How can I do this?</p>