I should not be slow,just splitting out numbers should take no time at all.
>>> s.split() >>> s = 'bbb 3 3' >>> s = s.split() >>> s ['bbb', '3', '3'] >>> s[-2:] ['3', '3'] >>> # To integer >>> [int(i) for i in s[-2:]] [3, 3]Can use regex to get number,but there should be no speed advantage to talk about.
>>> import re >>> >>> s = 'bbb 3 3' >>> re.findall(r'\d', s) ['3', '3']