python - How to select a row from a 2D tuple -
this straightforward thing can't it.
how go selecting "rows" (i use word row lack of better one) 2d (or nd) tuple?
a = [0,1,2,3] b = [4,5,6,7] c = (a,b)
i.e., how result ([1,2],[5,6])
c?
i've tried c[:][1:2]
result ([4, 5, 6, 7],)
you use comprehension:
tuple(x[1:3] x in c)
Comments
Post a Comment