I'm trying to cut a list by specific items in it, for example, I have a list like this:
down = ["a", "b", "c", "d", "b", "e", "r"]
What I want is:
[["a", "b"]["c", "d", "b"] ["e", "r"]]
which is cut after every occurrence of "b".
I wrote something like this:
down = ["a", "b", "c", "d", "b", "e", "r"]
up = []
while down is not []:
up, down = up.append(down[:(down.index("b") + 1)]), down[(down.index("b") + 1):]
It throws an error:
AttributeError: 'NoneType' object has no attribute 'append'
I can't figure out what's wrong.