split

Emile van Sebille emile at fenx.com
Fri Aug 9 08:21:03 EDT 2002


Terry Reedy:
> Another advertisement for the benefit of breaking long, complicated
> expressions into multiple lines and using temp variables ;-)
> 

Oh, but they're fun  ;-)

>>> y = [1,0,1,1,0,0,1,0]
>>> [map(int, list(x)) for x in ''.join(map(str,y)).split('0')]
[[1], [1, 1], [], [1], []]


--

Emile van Sebille
emile at fenx.com

---------




More information about the Python-list mailing list