You can just cover it in brackets.

a = 1234
print([a])

Or append()

b = []
b.append(a)

output

[1234]
Answer from Thavas Antonio 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
Discussions

python - Converting integer to digit list - Stack Overflow
What is the quickest and cleanest way to convert an integer into a list? For example, change 132 into [1,3,2] and 23 into [2,3]. I have a variable which is an int, and I want to be able to compar... More on stackoverflow.com
๐ŸŒ stackoverflow.com
Convert NumPy array to Python list - Stack Overflow
How do I convert a NumPy array into a Python List? More on stackoverflow.com
๐ŸŒ stackoverflow.com
Split up an integer of numbers into arrays of numbers
Convert the number to a string and the use slice notation to select the desired digits. More on reddit.com
๐ŸŒ r/learnpython
4
3
March 25, 2021
Creating a list of integers in Python - Stack Overflow
Is it possible to create a list of integers with a single line of code, without using any third-party libraries? I tried with the syntax: lst = list(int(1234)) or the syntax: lst = list(int(1,2,3, More on stackoverflow.com
๐ŸŒ stackoverflow.com
๐ŸŒ
freeCodeCamp
freecodecamp.org โ€บ news โ€บ convert-lists-to-arrays-and-back-in-python
How to Convert a List to an Array and Back in Python
December 11, 2025 - Sometimes, you may need to convert between arrays and lists in Python. For example, you may have data stored in a list that you need to pass to a function that requires an array.
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.

๐ŸŒ
DigitalOcean
digitalocean.com โ€บ community โ€บ tutorials โ€บ python-convert-numpy-array-to-list
Convert NumPy Array to List in Python Easily | DigitalOcean
April 19, 2025 - Learn how to convert a NumPy array to a Python list using simple methods with code examples. Ideal for beginners and data scientists working with NumPy.
๐ŸŒ
TutorialsPoint
tutorialspoint.com โ€บ article โ€บ convert-number-to-list-of-integers-in-python
Convert number to list of integers in Python
March 15, 2026 - Here's how to handle negative numbers ? negative_number = -1342 # Method 1: Using absolute value digits_list1 = [int(digit) for digit in str(abs(negative_number))] print("Using abs():", digits_list1) # Method 2: Remove minus sign first digits_list2 ...
Find elsewhere
๐ŸŒ
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.
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ python-program-to-convert-list-of-integer-to-list-of-string
Python - Convert List of Integers to a List of Strings - GeeksforGeeks
July 12, 2025 - For example, if we have a list like [1, 2, 3] then the output should be ['1', '2', '3']. In Python, there are multiple ways to do this efficiently, some of them are: using functions like map(), reduce() or even list comprehensions.
๐ŸŒ
NumPy
numpy.org โ€บ devdocs โ€บ reference โ€บ generated โ€บ numpy.ndarray.tolist.html
numpy.ndarray.tolist โ€” NumPy v2.6.dev0 Manual
Return a copy of the array data as a (nested) Python list. Data items are converted to the nearest compatible builtin Python type, via the item method.
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ python-convert-array-ordinary-list-items
Python - Convert an array to an ordinary list with the same items - GeeksforGeeks
December 17, 2024 - import array # Example with a regular ... 'a' print(b) ... If we are working with a NumPy array, we can use the tolist() method to convert it into a regular Python list....
๐ŸŒ
TutorialsPoint
tutorialspoint.com โ€บ article โ€บ conversion-of-integer-string-to-list-in-python
Conversion of Integer String to list in Python
March 27, 2026 - import numpy as np int_str = "11 16 17 14 89" result = np.fromstring(int_str, dtype=int, sep=' ').tolist() print("Converted list:", result) ... Use map() with split() for space-separated integers, and list comprehension for individual digit ...
๐ŸŒ
DataCamp
datacamp.com โ€บ doc โ€บ numpy โ€บ array-to-list
NumPy Array to List
In this syntax, array is the NumPy array you wish to convert into a Python list.
๐ŸŒ
Stack Overflow
stackoverflow.com โ€บ questions โ€บ 68848919 โ€บ creating-a-list-of-integers-in-python
Creating a list of integers in Python - Stack Overflow
Is it possible to create a list of integers with a single line of code, without using any third-party libraries? I tried with the syntax: lst = list(int(1234)) or the syntax: lst = list(int(1,2,3,...
๐ŸŒ
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].
๐ŸŒ
Programiz
programiz.com โ€บ python-programming โ€บ array
Python Array of Numeric Values
March 26, 2024 - If that's the case, visit the Python list tutorial. To create an array of numeric values, we need to import the array module. For example: import array as arr a = arr.array('d', [1.1, 3.5, 4.5]) print(a) ... Here, we created an array of float type.