title: How to remove whitespace in BeautifulSoup
body: <p>I have a bunch of HTML I'm parsing with BeautifulSoup and it's been going pretty well except for one minor snag. I want to save the output into a single-lined string, with the following as my current output:</p>
  
  <pre><code>    &lt;li&gt;&lt;span class="plaincharacterwrap break"&gt;
                      Zazzafooky but one two three!
                  &lt;/span&gt;&lt;/li&gt;
  &lt;li&gt;&lt;span class="plaincharacterwrap break"&gt;
                      Zazzafooky2
                  &lt;/span&gt;&lt;/li&gt;
  &lt;li&gt;&lt;span class="plaincharacterwrap break"&gt;
                      Zazzafooky3
                  &lt;/span&gt;&lt;/li&gt;
  </code></pre>
  
  <p>Ideally I'd like</p>
  
  <pre><code>&lt;li&gt;&lt;span class="plaincharacterwrap break"&gt;Zazzafooky but one two three!&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="plaincharacterwrap break"&gt;Zazzafooky2&lt;/span&gt;&lt;/li&gt;
  </code></pre>
  
  <p>There's a lot of redundant whitespace that I'd like to get rid of but it's not necessarily removable using <code>strip()</code>, nor can I blatantly remove all the spaces because I need to retain the text. How can I do it? It seems like a common enough problem that regex would be overkill, but is that the only way?</p>
  
  <p>I don't have any <code>&lt;pre&gt;</code> tags so I can be a little more forceful there.</p>
  
  <p>Thanks once again!</p>