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
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.

Discussions

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
Help! Beginner stuck on trying to convert a list of lists(int) to a simple list of integers in Python
map is not a particularly Pythonic structure. The normal way to do this would be with a list comprehension. The basic principle is you want to fetch the first item from each of the inner lists. So: flattened_list = [item[0] for item in nested_list] More on reddit.com
🌐 r/learnpython
10
2
June 20, 2024
python - Convert all strings in a list to integers - Stack Overflow
You can easily convert string list items into int items using loop shorthand in python ... The same solution has already been posted above. 2021-06-23T11:57:58.29Z+00:00 ... Save this answer. ... Show activity on this post. If your list contains pure integer strings, the accepted answer is ... More on stackoverflow.com
🌐 stackoverflow.com
November 30, 2021
How to convert a number from any base to base 10?

int has an optional argument called base that you may wish to look into:

http://docs.python.org/3/library/functions.html#int

Also, var names. Please

Edit: Without changing the way your code executes (excepting the base type expected)

def to_decimal(number, base):
    result = 0
    for index, character in enumerate(number):
        result += int(character) * base ** index
    return result

Readability counts!

More on reddit.com
🌐 r/learnpython
9
10
December 2, 2013
🌐
TutorialsPoint
tutorialspoint.com › article › convert-number-to-list-of-integers-in-python
Convert number to list of integers in Python
March 15, 2026 - This article explores two efficient approaches: list comprehension and the map() function with str(). List comprehension provides a concise way to convert each digit by first converting the number to a string, then iterating through each character ...
🌐
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 - Next, the map() function is called and converts cir_moon to a String (str(moon)). Then, each element is converted to an Integer (int). If output to the terminal at this point, a map() object similar to below would display. However, these results are converted into a List, saved to cir_list, and output to the terminal as a List of Integers.
🌐
GeeksforGeeks
geeksforgeeks.org › python › python-converting-all-strings-in-list-to-integers
Converting all Strings in a List to Integers - Python - GeeksforGeeks
July 11, 2025 - map() function applies a given function to all elements in an iterable. Here, we use map(int, a) to convert each string in the list to an integer. ... List comprehension provides a more Pythonic and concise way to convert a list of strings to ...
🌐
GeeksforGeeks
geeksforgeeks.org › python › python-integers-string-to-integer-list
Python - Integers String to Integer List - GeeksforGeeks
July 15, 2025 - The map(int, s.split()) applies the int function to each element, converting them to integers, and list() collects the results into a list, which is then printed as [1, 2, 3, 4, 5].
Find elsewhere
🌐
Python Help
pythonhelp.org › tutorials › convert-list-to-int
How to convert a list to int in Python
September 23, 2024 - A list is a collection of items, which can be of different data types, while an integer is a whole number without a fractional component. Converting a list to an integer involves transforming the list’s elements into a single numerical value. One of the most straightforward methods to convert a list to an integer is by using a loop.
🌐
Medium
medium.com › @aleksej.gudkov › how-to-convert-numbers-in-a-list-using-the-int-function-e20425dface6
How to Convert Numbers in a List Using the int() Function | by UATeam | Medium
November 24, 2024 - numbers = ["1", "2", "3", "4"] int_numbers = list(map(int, numbers)) print(int_numbers) # Output: [1, 2, 3, 4] If your list contains a mix of strings and numbers, you can filter or preprocess the list before conversion. numbers = ["1", 2, "3.5", ...
🌐
TutorialsPoint
tutorialspoint.com › conversion-of-integer-string-to-list-in-python
Conversion of Integer String to list in Python
August 14, 2023 - The most common approach uses map() and split() to convert space-separated integers ? int_str = "1 2 3 4 5" result = list(map(int, int_str.split())) print("Converted list:", result)
🌐
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' ...
🌐
PythonForBeginners.com
pythonforbeginners.com › home › list of strings to list of integers in python
List of Strings to List of Integers in Python - PythonForBeginners.com
April 1, 2022 - Lists are one of the most used container objects in python programming. In this article, we will discuss various approaches to convert a list of strings to a list of integers in python. We can convert a list of strings to a list of integers using a for loop and the int() function.
🌐
Finxter
blog.finxter.com › 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
April 9, 2021 - You can watch me explain list comprehensions in this video: ... The built-in function int() converts a string to an integer.
🌐
LabEx
labex.io › tutorials › convert-number-to-digit-list-in-python-13623
Convert Number to Digit List in Python
Use the map() function combined with the int function to convert each character in the string to an integer.
🌐
YouTube
youtube.com › watch
How To Convert List To Integer In Python - YouTube
How To Convert List To Integer In Python? This tutorial answers that question. Converting a list to integer in Python consists of taking the list of numbers,...
Published: April 3, 2024
🌐
Delft Stack
delftstack.com › home › howto › python › python convert list of strings to ints
How to Convert List of Strings to Integer in Python | Delft Stack
March 11, 2025 - Using list comprehension, we iterate over each string in the list and apply the int() function to convert it into an integer. The result is a new list called int_list, which contains the converted integers.