Python map string to int | Example code

Using the map() function you can convert a list of strings into a list of int (number).

Python map string to int example

Simple example code converts the list to an integer list using the map function.

T1 = ['13', '17', '18', '21', '32']

res = list(map(int, T1))



Python map string to int

Do comment if you have any doubts and suggestions on this Python map string program.

Note: IDE: PyCharm 2021.1.3 (Community Edition)

Windows 10

Python 3.7

All Python Examples are in Python 3, so Maybe its different from python 2 or upgraded versions.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.