Extracting a number from an unspaced string in Python
<p>I need to extracted a number from an unspaced string that has the number in brakets for example: </p>

<pre><code>"auxiliary[0]"
</code></pre>

<p>The only way I can think of is:</p>

<pre><code>def extract_num(s):    
   s1=s.split["["]
   s2=s1[1].split["]"]
   return int(s2[0])
</code></pre>

<p>Which seems very clumsy, does any one know of a better way to do it? (The number is always in "[ ]" brakets)</p>
