title: How do I extract numbers from a string in Python?
body: <p>I would like to extract numbers from an input string in Python.</p>
  <p>For example, If the input string is:</p>
  <pre><code>CS9ED389^329IP&quot;~a48#
  </code></pre>
  <p>Expected Output is:</p>
  <pre><code>[9, 389, 329, 48]
  </code></pre>
  <p>I did try this, but didn't work:</p>
  <pre><code>val = &quot;CS9ED389^329IP~a48#&quot;
  
  result = re.findall(&quot;\d+&quot;, val)
  </code></pre>