How to convert list of string number into a list of integers in Python

2 Answers

0 votes
lst = ['1', '6', '3', '9', '7', '2'] 
  
lst_int = map(int, lst) 

print(list(lst_int))
 

 
'''
run:
 
[1, 6, 3, 9, 7, 2]
 
'''

 



answered Dec 21, 2019 by avibootz
0 votes
lst = ['1', '6', '3', '9', '7', '2'] 
  
lst_int = [int(n) for n in lst] 

print(lst_int)
 

 
'''
run:
 
[1, 6, 3, 9, 7, 2]
 
'''

 



answered Dec 21, 2019 by avibootz

Related questions

...