Mensanator <mensanator at aol.com> writes: > And the re module doesn't help. > > >>> f = ' 1 2 3 4 ' > >>> re.split(' ',f) > ['', '', '1', '2', '', '3', '', '', '4', '', '', '', ''] filter(bool, re.split(' ', f)) You might also like: from itertools import groupby c = '0010000110' print list(list(xs) for k,xs in groupby(c))