I have a list of elements which internally is separated by 0s. The format is like that:
[0, 2, 2, 0, 1, 5, 5, 3, 1, 3, 0, 7, 4, 6, 7, 4, 6]
I would like to use the zeros as separators and split it into sublists. In that example its:
[[], [2, 2], [1, 5, 5, 3, 1, 3], [7, 4, 6, 7, 4, 6]]
The zeros will therefore disappear. A leading zero or an ending zero should make an empty list at the beginning or the end.
Until know, I do that in an ugly way by joining the list together to a string, then split it and make a list of it again.
Is there a fancy pythonic way to do that easier?