I need to extracted a number from an unspaced string that has the number in brakets for example:
"auxiliary[0]"
The only way I can think of is:
def extract_num(s):
s1=s.split["["]
s2=s1[1].split["]"]
return int(s2[0])
Which seems very clumsy, does any one know of a better way to do it? (The number is always in "[ ]" brakets)