def splitStringWithNumbers(string):
 rawParts = re.split('(\\d+)', string)
 nonEmptyParts = filter(None, rawParts)
 def splitHelper(nonEmptyParts):
  for part in nonEmptyParts:
   if re.match('\\d+', part):
    (yield int(part))
   else:
    (yield part)
 return list(splitHelper(nonEmptyParts))

def splitStringWithNumbers ( string ) : rawParts = re . split ( '(\\d+)' , string ) nonEmptyParts = filter ( None , rawParts ) def splitHelper ( nonEmptyParts ) : for part in nonEmptyParts : if re . match ( '\\d+' , part ) : ( yield int ( part ) ) else : ( yield part ) return list ( splitHelper ( nonEmptyParts ) )
splits input string into a list of items .