I have a tuple a = (('1414', 'A'), ('1416', 'B')) and I need to obtain the result as result = ((1414, 'A'), (1416, 'B')).
I tried tuple([map(int, x[0]) for x in a]) based on How to convert strings into integers in Python? and I get the result as ([1414], [1416]). How would I maintain the result as a tuple with the changed value instead of making it as a list?
b = ('1414', 'A')into1414? It would just beint(b[0]), right? No reason to usemap? So, what happens if you then try applying that logic to the overall tuple of tuples? BTW, the described output does not match; in 2.x it would result in([1, 4, 1, 4], [1, 4, 1, 6]), and in 3.x the result is a pair ofmapobjects. Considering the 2.x result carefully makes it clear where the fault is. But at any rate, this problem is caused by a typo and/or not reproducible.