I have a list of objects, and I wish to get a list of list of objects, splitted using objects from another list, like that:
l = ['x',1,2,3,'a',5,6,1,7]
and another list of objects
s = ['a', 1, 4]
And I wish to get the result so:
[ ['x'], [1, 2, 3], ['a', 5, 6], [1, 7] ]
Is there a nice/pythonic way to do it ?
EDIT:
I want the head of each resulted list to be an element of s
, and all these lists to keep the elements of initial list in the same order.