Possible Duplicate: How to convert strings into integers in Python?
Hello guys,
I am trying to convert this string integers from a nested list to integers. This is my list:
listy = [['+', '1', '0'], ['-', '2', '0']]
I trying to convert to this:
[['+', 1, 2], ['-', 2, 0]]
This what I have tried so far, but my second line of code is taken from one of the answers in the question How to convert strings into integers in Python?
listy = [['+', '1', '0'], ['-', '2', '0']]
T2 = [list(map(int, x)) for x in listy]
print(T2)
But it gives me an error:
ValueError: invalid literal for int() with base 10: '+'
Is there any possible way to fix this in Python 3?