Splitting a string where it switches between numeric and alphabetic characters
<p>I am parsing some data where the standard format is something like <code>10 pizzas</code>. Sometimes, data is input correctly and we might end up with <code>5pizzas</code> instead of <code>5 pizzas</code>.  In this scenario, I want to parse out the number of pizzas.</p>

<p>The naïve way of doing this would be to check character by character, building up a string until we reach a non-digit and then casting that string as an integer.</p>

<pre><code>num_pizzas = ""
for character in data_input:
   if character.isdigit():
      num_pizzas += character
   else:
      break
num_pizzas = int(num_pizzas)
</code></pre>

<p>This is pretty clunky, though.  Is there an easier way to split a string where it switches from numeric digits to alphabetic characters?</p>
