Convert the integer to string first, and then use map to apply int on it:

>>> num = 132
>>> map(int, str(num))    #note, This will return a map object in python 3.
[1, 3, 2]

or using a list comprehension:

>>> [int(x) for x in str(num)]
[1, 3, 2]
Answer from Ashwini Chaudhary on Stack Overflow
🌐
GeeksforGeeks
geeksforgeeks.org › python › python-convert-number-to-list-of-integers
Python - Convert Number to List of Integers - GeeksforGeeks
Combination of str() and map() is a straightforward and efficient way to convert a number into a list of integers.
Published: July 11, 2025
🌐
Reddit
reddit.com › r/learnpython › how to convert string list to int list?
r/learnpython on Reddit: How to convert string list to int list?
June 4, 2023 -

numbers = input("Please type some numbers: ").split()
for n in range(0, len(numbers)):
numbers[n] = int(numbers[n])

Just tried converting a string list to an int list using a for loop and made this code but not sure what it means step by step, if someone could please explain the last 2 lines it would be much appreciated. Thanks!

Discussions

python - Convert all strings in a list to integers - Stack Overflow
The inverse is ( to convert a list of int to list of string ) : map( str, results) 2017-03-11T22:08:40.493Z+00:00 ... You can simplify this answer: just always use list(map(int, results)), it works for any Python version. More on stackoverflow.com
🌐 stackoverflow.com
How to convert an integer to a list in python? - Stack Overflow
Why do you need to convert it to a string first? Just [a] will make a list. ... Save this answer. ... Show activity on this post. You can just cover it in brackets. ... Save this answer. ... Show activity on this post. ... Save this answer. ... Show activity on this post. ... RomJan D. Hossain ... Save this answer. ... Show activity on this post. If you are trying to put your int ... More on stackoverflow.com
🌐 stackoverflow.com
Converting an int into a python List - Stack Overflow
How do I convert an int into a list of its digits for eg. a = 1234 I have to use it as [1,2,3,4] I have tried using list(a) But it shows an error.Anything else that I could use More on stackoverflow.com
🌐 stackoverflow.com
March 2, 2014
How to convert an input (number+string) to list, without converting the number into a string?
2 started as string, it was never an int. You can convert it to int if you want. with list_num[0] = int(list_num[0]) More on reddit.com
🌐 r/learnpython
7
1
March 6, 2022
Top answer
1 of 12
106

Convert the integer to string first, and then use map to apply int on it:

>>> num = 132
>>> map(int, str(num))    #note, This will return a map object in python 3.
[1, 3, 2]

or using a list comprehension:

>>> [int(x) for x in str(num)]
[1, 3, 2]
2 of 12
24

There are already great methods already mentioned on this page, however it does seem a little obscure as to which to use. So I have added some mesurements so you can more easily decide for yourself:


A large number has been used (for overhead) 1111111111111122222222222222222333333333333333333333

Using map(int, str(num)):

import timeit

def method():
    num = 1111111111111122222222222222222333333333333333333333
    return map(int, str(num))

print(timeit.timeit("method()", setup="from __main__ import method", number=10000)

Output: 0.018631496999999997

Using list comprehension:

import timeit

def method():
    num = 1111111111111122222222222222222333333333333333333333
    return [int(x) for x in str(num)]

print(timeit.timeit("method()", setup="from __main__ import method", number=10000))

Output: 0.28403817900000006

Code taken from this answer

The results show that the first method involving inbuilt methods is much faster than list comprehension.

The "mathematical way":

import timeit

def method():
    q = 1111111111111122222222222222222333333333333333333333
    ret = []
    while q != 0:
        q, r = divmod(q, 10) # Divide by 10, see the remainder
        ret.insert(0, r) # The remainder is the first to the right digit
    return ret

print(timeit.timeit("method()", setup="from __main__ import method", number=10000))

Output: 0.38133582499999996

Code taken from this answer

The list(str(123)) method (does not provide the right output):

import timeit

def method():
    return list(str(1111111111111122222222222222222333333333333333333333))
    
print(timeit.timeit("method()", setup="from __main__ import method", number=10000))

Output: 0.028560138000000013

Code taken from this answer

The answer by Duberly González Molinari:

import timeit

def method():
    n = 1111111111111122222222222222222333333333333333333333
    l = []
    while n != 0:
        l = [n % 10] + l
        n = n // 10
    return l

print(timeit.timeit("method()", setup="from __main__ import method", number=10000))

Output: 0.37039988200000007

Code taken from this answer

Remarks:

In all cases the map(int, str(num)) is the fastest method (and is therefore probably the best method to use). List comprehension is the second fastest (but the method using map(int, str(num)) is probably the most desirable of the two.

Those that reinvent the wheel are interesting but are probably not so desirable in real use.

🌐
Finxter
blog.finxter.com › home › learn python blog › how to convert an integer to a list in python
How to Convert an Integer to a List in Python - Be on the Right Side of Change
August 22, 2022 - The results are output to the terminal as a List of Integers. This example uses List and the map() function to convert an Integer to a String, extract each element and convert it to a List of Integers.
🌐
TutorialsPoint
tutorialspoint.com › article › convert-number-to-list-of-integers-in-python
Convert number to list of integers in Python
March 15, 2026 - The map() function applies the ... print("Given number:", number) # Convert to list of digits using map() digits_list = list(map(int, str(number))) # Result print("List of digits:", digits_list)...
🌐
w3resource
w3resource.com › python-exercises › list › python-data-type-list-exercise-234.php
Python: Convert a given number (integer) to a list of digits - w3resource
June 28, 2025 - # Define a function 'digitize' that takes an integer 'n' as input. def digitize(n): # Convert the integer 'n' to a string, map each character to an integer, and create a list of those integers. return list(map(int, str(n))) # Call the 'digitize' function with example integers and print the results. print(digitize(123)) print(digitize(1347823)) ... Write a Python program to convert a given number into a list of its digits in reverse order.
Find elsewhere
🌐
YouTube
youtube.com › dataeng uncomplicated
Convert a String of Numbers Into a List of Int in Python - YouTube
In one line of code, this tutorial explains how to convert a string of numbers into a list of integers in python. When pulling data from various sources, you...
Published: December 5, 2020
Views: 23K
🌐
GeeksforGeeks
geeksforgeeks.org › python › python-integers-string-to-integer-list
Python - Integers String to Integer List - GeeksforGeeks
July 15, 2025 - Using list comprehension allows you to create a new list by applying an expression to each element of an iterable. This method is compact and often more readable than traditional loops, making it ideal for transforming or filtering elements of a list or string. ... # Input string of integers s = "1 2 3 4 5" # Convert the string to a list of integers using list comprehension int_list = [int(i) for i in s.split()] # Print the result print(int_list)
🌐
HatchJS
hatchjs.com › home › how to convert an integer to a list in python
How to Convert an Integer to a List in Python
January 5, 2024 - In Python, an integer is a whole number, positive or negative. A list is a collection of items, which can be of different data types. To convert an integer to a list in Python, you can use the following methods:
🌐
Talkerscode
talkerscode.com › howto › how-to-convert-int-to-list-in-python.php
How To Convert INT To List In Python - TalkersCode.com
In this example, we use the print() function and the + string concatenation operator to print the original number. Reducing a number to a list of integers is accomplished using the reduce() function.
🌐
TutorialsPoint
tutorialspoint.com › article › conversion-of-integer-string-to-list-in-python
Conversion of Integer String to list in Python
March 27, 2026 - int_str = "14 -15 17 18" result = [] i = 0 while i < len(int_str): if int_str[i].isdigit() or int_str[i] == '-': num = "" while i < len(int_str) and (int_str[i].isdigit() or int_str[i] == '-'): num += int_str[i] i += 1 if num and num != '-': result.append(int(num)) else: i += 1 print("Converted list:", result) ... import numpy as np int_str = "11 16 17 14 89" result = np.fromstring(int_str, dtype=int, sep=' ').tolist() print("Converted list:", result)
🌐
Quora
quora.com › How-do-I-convert-an-7-digit-integer-to-a-list-in-Python
How to convert an 7-digit integer to a list in Python - Quora
Quora is a place to gain and share knowledge. It's a platform to ask questions and connect with people who contribute unique insights and quality answers.
🌐
Finxter
blog.finxter.com › home › learn python blog › how to convert a string list to an integer list in python
How to Convert a String List to an Integer List in Python - Be on the Right Side of Change
January 19, 2023 - The most Pythonic way to convert a list of strings to a list of ints is to use the list comprehension [int(x) for x in strings]. It iterates over all elements in the list and converts each list element x to an integer value using the int(x) ...