title: How to replace non-alphabetic AND numeric characters in a string in python
body: <p>I understand that to replace non-alphanumeric characters in a string a code would be as follows:</p>
  
  <pre><code>words = re.sub("[^\w]", " ",  str).split()
  </code></pre>
  
  <p>However, <code>^\w</code> replaces non-alphanumeric characters. I want to replace both non-alphabetic and numeric chars in a string like: </p>
  
  <pre><code>"baa!!!!! baa sheep23? baa baa"
  </code></pre>
  
  <p>and I want it to have an outcome like this:  </p>
  
  <pre><code> "baa baa sheep baa baa"
  </code></pre>
  
  <p>If I do <code>words = re.sub("[^\w\d]", " ",  str).split()</code>, I get an outcome with numeric characters, like <code>'sheep23'</code>. I guess that it could be because <code>"^"</code> affects  <code>\d</code> as well and it counts as if I want the non-numeric characters removed. How do I do this right?</p>