Suppose I have
x = ((1, 2, 3), (4, 5, 6), (7, 8, 9))
How do I get to
x = ((1, 2), (4, 5), (7, 8))
?
The only way I figured out was using list comprehension then converting back to a tuple:
x = tuple([n[1:len(n)] for n in x])
But I feel that’s an ugly way of doing it…
1 Answer