I’d like to split a comma separated value into pairs:
>>> s = '0,1,2,3,4,5,6,7,8,9'
>>> pairs = # something pythonic
>>> pairs
[(0, 1), (2, 3), (4, 5), (6, 7), (8, 9)]
What would # something pythonic look like?
How would you detect and handle a string with an odd set of numbers?
Something like:
Full example:
If the number of items is odd, the last element will be ignored. Only complete pairs will be included.