Possible Duplicate:
What is the easiest way to convert list with str into list with int?
current array: ['1','-1','1'] desired array: [1,-1,1]
Use int which converts a string to an int, inside a list comprehension, like this:
desired_array = [int(numeric_string) for numeric_string in current_array] 
                        List comprehensions are the way to go (see @sepp2k's answer). Possible alternative with map:
list(map(int, ['1','-1','1'])) 
                        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