title: Preferred way to remove whitespace from a string
body: <p>I want to remove all spaces from a string.</p>
  
  <blockquote>
    <p>" as fa   sdf sdfsdf "</p>
  </blockquote>
  
  <p>The result would be:</p>
  
  <blockquote>
    <p>"asfasdfsdfsdf"</p>
  </blockquote>
  
  <p>There are several ways I can think of to achieve this, and I'm wondering which one is the best.</p>
  
  <p>1.</p>
  
  <pre><code>"".join(" as fa   sdf sdfsdf ".split())
  </code></pre>
  
  <p>2.</p>
  
  <pre><code>" as fa   sdf sdfsdf ".replace(" ", "")
  </code></pre>
  
  <p>And I assume that there are more.<br>
  Which one is preferred?</p>