Python
Snippets
.Dev
Archive
Login with GitHub
Convert a list of strings to integers
This method is much handy when we take user input that comes as a string. The below line of python can convert your list of strings to integers.
Python: 3.0
Anurag Rana
16 Jul 2021
0
Login to upvote
1
2
3
4
list(map(int,
[
'1'
,
'2'
,
'3'
]))
# output
# [1, 2, 3]
list(map(int, ['1', '2', '3'])) # output # [1, 2, 3]
Copy
| Download as:
.py file
PNG
Share on:
FB
Twitter
LinkedIn
WA
Previous
Random Snippet
Next
©2021 - code108labs Contributors Hosted on
DigitalOcean
Partner website:
pythoncircle.com