Last modified: Jan 10, 2023 By Alexander Williams
how to convert python list str to int
in this tutorial we'll learn how to convert a string list to int list
syntax
1 | list(map(int,your_list) |
example
1 2 3 4 5 6 7 8 | #liststr_list=['1','2','3','4','5','6']#convert list str to intconv=list(map(int,str_list))#printprint(conv) |
output
[1, 2, 3, 4, 5, 6]