Parsing and Storing HTML Tags Along With Text <p>I'm looking for a way to parse unicode strings of html and essentially split all of the elements of the string (html elements as well as individual tokens) and store them in a list. <code>BeautifulSoup</code> obviously has some nice functionality for parsing html, such as the <code>.get_text</code> method, but this doesn't preserve the tags themselves.</p> <p>What I need is something like this. Given an html unicode string such as </p> <p><code>s = u'&lt;b&gt;This is some important text!&lt;/b&gt;</code>, </p> <p>what I would like to have as a result is a list like this:</p> <p><code>['&lt;b&gt;', 'This', 'is', 'some', 'important', 'text!', '&lt;/b&gt;']</code></p> <p>There must be an easy way to do this with BeautifulSoup that I'm just not seeing in SO searches. Thanks for reading.</p> <p><b>EDIT:</b> since this has been getting some questions as to the purpose of storing the tags, I'm interested in using the tags as features for a project in text classification. I'm experimenting with using different structural features from an online discussion forum in addition to the n-grams present within forum posts.</p>