I would like to change
mylist = [['1'],['2'],['3']]
to be
mynewlist = (1,2,3)
How to do that in python ?
I would like to change
mylist = [['1'],['2'],['3']]
to be
mynewlist = (1,2,3)
How to do that in python ?
A simple list comprehension will do:
mynewlist = [int(x[0]) for x in mylist]
Of course, if you actually want a tuple as output:
mynewtuple = tuple(int(x[0]) for x in mylist)