How to convert tuple type to int on python?
What you have there is a tuple inside a tuple. So you want the first item of the outer tuple, which is u_data[0]
: the innermost tuple. And then you want the first item of that, which is u_data[0][0]
. That's a float
, so to get an integer, you want to wrap the whole thing in int()
, leading us to:
int(u_data[0][0])