If I have an array such:
inner_loop =
[
[
[18, 119], [42, 119], [42, 95], [18, 95]
],
[
[80, 96], [80, 75], [59, 75], [59, 96]
]
]
how do I convert it to a multidimensional tuple like
(
(
(18, 119), (42, 119), (42, 95), (18, 95)
),
(
(80, 96), (80, 75), (59, 75), (59, 96)
)
)
I have tried:
tuple(tuple(y) for y in (tuple(tuple (x) for x in (tuple(inner_loops)))))
but the last level is not converted.
tuple(tuple(tuple(l2) for l2 in l1) for l1 in inner_loop)
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