Beautiful Soup: get contents of search result tag
<p>Trying to get the contents of this type of html snippet using beautiful soup (it is a "tag" object).</p>

<pre><code>&lt;span class="font5"&gt; arrivesÂ at this calculation from the Torahâs report that the delugeÂ (rains) began on the 17&lt;sup&gt;th&lt;/sup&gt; day of the second monthÂ &lt;/span&gt;
</code></pre>

<p>I've tried:</p>

<pre><code>soup.contents.find_all('span')
soup.find_all('span')
soup.find_all(re.compile("font[0-9]+"))
soup.string
soup.child
</code></pre>

<p>And none of these seem to be working. What can I do?</p>

<p><code>soup.find_all('span')</code> does work; returns all <code>span</code> tags.</p>

<p>If you want to get <code>span</code> tag with <code>font&lt;N&gt;</code> class, specify the pattern as a keyword argument <code>class_</code>:</p>

<pre><code>soup.find_all('span', class_=re.compile('font[0-9]+'))
</code></pre>

python beautifulsoup