This has to be easier than what I am running into. My problem is turning a string that looks like this:
12 * ABC
3 * DEF
56 * G
7 * HIJ
re.findall should work for you.
import re s = "ABC12DEF3G56HIJ7" pattern = re.compile(r'([A-Z]+)([0-9]+)') for (letters, numbers) in re.findall(pattern, s): print numbers, '*', letters