a splitting headache

Paul Rubin http
Sat Oct 17 06:41:11 CEST 2009


Mensanator <mensanator at aol.com> writes:
> Thanks, but what I wanted was
> ['00','1','0','1','0','1111','00','1','0' '1'].

    >>> c = '001010111100101'
    >>> list(''.join(g) for k,g in groupby(c))
    ['00', '1', '0', '1', '0', '1111', '00', '1', '0', '1']

is really not that unnatural.



More information about the Python-list mailing list