title: Replace text in python with BeautifulSoup
body: <p>I am trying to parse a table with beautifulSoup and remove the blank spaces found in some rows with - so instead of </p>
  
  <pre><code>&lt;tr&gt;
  &lt;td&gt;&lt;small&gt;15&lt;/small&gt;&lt;/td&gt;
  &lt;td&gt;&lt;small&gt;&lt;small&gt;Cat&lt;/small&gt;&lt;/small&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;&lt;small&gt;&lt;small&gt;   &lt;/small&gt;&lt;/small&gt;&lt;/td&gt;
  &lt;td&gt;&lt;small&gt;&lt;small&gt; &lt;/small&gt;&lt;/small&gt;&lt;/td&gt;
  &lt;/tr&gt;
  </code></pre>
  
  <p>I want</p>
  
  <pre><code>&lt;tr&gt;
  &lt;td&gt;&lt;small&gt;15&lt;/small&gt;&lt;/td&gt;
  &lt;td&gt;&lt;small&gt;&lt;small&gt;Cat&lt;/small&gt;&lt;/small&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;&lt;small&gt;&lt;small&gt;-&lt;/small&gt;&lt;/small&gt;&lt;/td&gt;
  &lt;td&gt;&lt;small&gt;&lt;small&gt;-&lt;/small&gt;&lt;/small&gt;&lt;/td&gt;
  &lt;/tr&gt;
  </code></pre>
  
  <p>I have kind of managed to do this with:</p>
  
  <pre><code>from bs4 import BeautifulSoup
  
  soup = BeautifulSoup (open("table.html"))
  
  for a in soup.findAll('small'):
      a.replaceWith("-")
  </code></pre>
  
  <p>That does remove the space, but it also removes the text 15 and cat (I know what I have replaces everything in the  tag). That is as far as I have been able to get. How can I fix that code so it will only replace the space with -?</p>
  
  <p>EDIT: Sorry here is the raw code</p>
  
  <pre><code>&lt;tr&gt;
  &lt;td&gt;&lt;small&gt;15&lt;/small&gt;&lt;/td &gt;
  &lt;td&gt;&lt;small&gt;&lt;small&gt;&amp;nbsp;&lt;/small&gt;&lt;/small&gt;&lt;/td &gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;&lt;small&gt;&lt;small&gt;&amp;nbsp; &amp;nbsp;&lt;/small&gt;&lt;/small&gt;&lt;/td &gt;
  &lt;td&gt;&lt;small&gt;&lt;small&gt;&amp;nbsp;&lt;/small&gt;&lt;/small&gt;&lt;/td &gt;
  &lt;/tr&gt;
  </code></pre>