I have for example the following list:
[\'|\', u\'MOM\', u\'DAD\', \'|\', u\'GRAND\', \'|\', u\'MOM\', u\'MAX\', u\'JULES\', \'|\']
and wan
itertools.groupby() does this very nicely...
>>> import itertools
>>> l = ['|', u'MOM', u'DAD', '|', u'GRAND', '|', u'MOM', u'MAX', u'JULES', '|']
>>> key = lambda sep: sep == '|'
>>> [list(group) for is_key, group in itertools.groupby(l, key) if not is_key]
[[u'MOM', u'DAD'], [u'GRAND'], [u'MOM', u'MAX', u'JULES']]