3 ms·
If you want to split a list into a head and a tail: head, *tail = list_to_split In Python 2, the best way I know of for this is head, tail = list_to_
by Smaug123 9y ago
If you want to split a list into a head and a tail:
head, *tail = list_to_split
In Python 2, the best way I know of for this is
head, tail = list_to_split[0], list_to_split[1:]
which is unwieldy.