Ordered list of text and element data of an html element with beautifulsoup
<p>I would like to parse the content of the following div element with BeautifulSoup (bs4):</p>

<pre><code>&lt;div&gt;&lt;!--block--&gt;&amp;nbsp; &amp;nbsp; Some text is here&amp;nbsp;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; - Another text&amp;nbsp;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; - More text&amp;nbsp;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/div&gt;
</code></pre>

<p>I need an ordered list of the content. The list shall contain the following items for this case:</p>

<pre><code>- non-breaking space
- non-breaking space
- text data
- br
- non-breaking space
...
- non-breaking space
</code></pre>

<p>Using tag.find_all() I can get a list of tags like "br" but all other data such as non-breaking space or text data is not returned by tag.find_all().</p>

<p>tag.contents is what I was looking for.</p>

python html screen-scraping