Can be done with regex, although not as elegant as itertools solutions
answer = [len(item) for item in filter(None, re.split(r"[^1]+", test_string))]
Or, more elegantly:
answer = [len(item) for item in re.findall(r"1+", test_string)]
and even more elegant (Jon loans):
answer = map(len, re.findall("1+", test_string))
source share