numpy array into tuple
>>> arr = numpy.array(((2,2),(2,-2)))
>>> tuple(map(tuple, arr))
((2, 2), (2, -2))
4
4
def totuple(a):
try:
return tuple(totuple(i) for i in a)
except TypeError:
return a
Thank you!
4
0
Are there any code examples left?
New code examples in category Python