This is probably a very straightforward thing but I can't get it.
How do you go about selecting "rows" (I use the word row for lack of a better one) from a 2D (or nD) tuple?
A = [0,1,2,3]
B = [4,5,6,7]
C = (A,B)
I.E., how do I get the result ([1,2],[5,6])
from C?
I've tried C[:][1:2]
but I get the result ([4, 5, 6, 7],)
You could use a comprehension:
tuple(x[1:3] for x in C)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With