Possible Duplicate:
Remove leading and trailing zeros from multidimensional list in Python
if I have a list such as:
my_list = [[1,2,0,1], [1,0,0,1]]
I want to split this at the zeros and throw them away, so that I end up with something like:
my_list = [[[1, 2], [1]], [[1],[1]]]
Any help much appreciated.
Divide an conquer, you can use a list comprehension to transform it to a simpler problem
and Akavall gives a great hint to split the list