Is there a str.split equivalent for lists in Python?

Viewed 984

If I have a string, I can split it up around whitespace with the str.split method:

"hello world!".split()

returns

['hello', 'world!']

If I have a list like

['hey', 1, None, 2.0, 'string', 'another string', None, 3.0]

Is there a split method that will split around None and give me

[['hey', 1], [2.0, 'string', 'another string'], [3.0]]

If there is no built-in method, what would be the most Pythonic/elegant way to do it?

5 Answers
Related