If we have a list of strings in python and want to create sublists based on some special string how should we do?
For instance:
l = ["data","more data","","data 2","more data 2","danger","","date3","lll"]
p = split_special(l,"")
would generate:
p = [["data","more data"],["data 2","more data 2","danger"],["date3","lll"]]
itertools.groupby is one approach (as it often is):
We can even cheat a little because of this particular case: