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

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
python - Convert a number to a list of integers - Stack Overflow
By clicking โ€œSign upโ€, you agree to our terms of service and acknowledge you have read our privacy policy. ... Stack Internal Implement a knowledge platform layer to power your enterprise and AI tools. More on stackoverflow.com
๐ŸŒ stackoverflow.com
How to convert string list to int list?
This is not how you would do this in Python. Any time you see code with range(len(something)), you know you are doing it wrong. The way to do it would be this: numbers = [int(num) for num in numbers] More on reddit.com
๐ŸŒ r/learnpython
8
5
June 4, 2023
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.

๐ŸŒ
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 ...
๐ŸŒ
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' ...
๐ŸŒ
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.
Find elsewhere
๐ŸŒ
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 = "1 2 3 4 5" result = list(map(int, int_str.split())) print("Converted list:", result)
๐ŸŒ
Python Help
pythonhelp.org โ€บ tutorials โ€บ convert-list-to-int
How to convert a list to int in Python
September 23, 2024 - If the list contains non-numeric values, you will encounter a ValueError during the conversion process. Itโ€™s crucial to validate the data before conversion. The size of the list you can convert depends on the available memory and the maximum integer size in Python.
๐ŸŒ
LabEx
labex.io โ€บ tutorials โ€บ convert-number-to-digit-list-in-python-13623
Convert Number to Digit List in Python
Write a function digitize(n) that takes a non-negative integer n as input and returns a list of its digits. The function should accomplish this by performing the following steps: Convert the input number n to a string.
๐ŸŒ
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.
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ python-integers-string-to-integer-list
Python - Integers String to Integer List - GeeksforGeeks
July 15, 2025 - Using split() and map() will allow us to split a string into individual elements and then apply a function to each element. ... s = "1 2 3 4 5" # Convert the string to a list of integers using split and map int_list = list(map(int, s.split())) ...
๐ŸŒ
YouTube
youtube.com โ€บ watch
How to convert a list of ints to a list of strings in Python - YouTube
In this tutorial, I'm gonna be showing you how to convert a list of ints to a list of strings in Python by using map() function.
Published: June 3, 2021
๐ŸŒ
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
๐ŸŒ
YouTube
youtube.com โ€บ watch
Python Tips: Converting a string list to an integer list, in 1 line - YouTube
A simple easy way to turn a list of strings into integers in python, all in one line.
Published: March 8, 2021