3 ms·
I hope the new itertools.pairwise could be added to strings and lists with split() e.g. 'abcdef'.split(2) == ['ab', 'cd', 'ef'] # not the same as .split("2"
by est 4y ago
I hope the new itertools.pairwise could be added to strings and lists with split()
e.g.
'abcdef'.split(2) == ['ab', 'cd', 'ef'] # not the same as .split("2")
[1, 2, 3, 4, 5, 6].split(3) == [[1,2,3], [4,5,6]]
Or one can use the `grouper` from the recipe
https://docs.python.org/3/library/itertools.html#itertools-recipes https://docs.python.org/3/library/itertools.html#itertools-r...
- robertlagrant 4y ago> 'abcdef'.split(2) == ['ab', 'cd', 'ef'] # not the same as .split("2") Pairwise would give you ['ab', 'bc', 'cd', 'de', 'ef']. It's not a split.