Python cut list by a certain word

Viewed 396

I have a list like this:

[["tab1", None], ["val1", 10], ["val2", "test"], ["val3", 20], ["tab2", None], ["val4", "test"], ["val5", 30]]

and i am searching for a method that cut in n lists if the word "tab" is found, the result could be this:

list1 = [["val1", 10], ["val2", "test"], ["val3", 20]]

list2 = [["val4", "test"], ["val5", 30]]

I try with some for cycle but nothing done.

but i don't have idea how this is possible with python. Someone have an idea?

Thanks in advance

2 Answers
Related