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
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
python - Converting list of list of Int32 values to list of list of int values - Stack Overflow
I have a list of lists which contain numpy int32 values. I would like to convert all of these int32 values to regular int. The reason is because as a part of my process these values are fed into a ... More on stackoverflow.com
🌐 stackoverflow.com
Django rest framework how to serialize a list of strings?

You can't just pass a list of strings. JSON is basically like a python dictionary. You need to format your object as a dictionary e.g.

{"strings":[string1, string2, string3]}

Each string above is a string object.

It's better to pass each string though with a dictionary keyword so it's easier to extract later, or nested dictionaries if you need nester data storage.

Serialising converts python objects to JSON but it has to be something that has similar properties to JSON in terms of structure. Python has that in dictionaries, so we feed it dictionaries. Read up on JSON and how it looks. You'll recognize the similarities instantly.

More on reddit.com
🌐 r/Python
3
1
September 28, 2017
🌐
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.
🌐
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 - Next, we create an array called my_array by calling the array() function and passing it two arguments: the type code 'i', which specifies that we want an array of signed integers, and my_list, which is the list we want to convert. When we print my_array, we should see the following output: ... This shows that my_array is now an array containing the same values as my_list. To convert an array back to a list, we can use Python's built-in list() function. Here's an example of how to convert an array to a list in Python:
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.

🌐
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
🌐
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.
Find elsewhere
🌐
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 - Write a Python program to convert a given number (integer) to a list of digits. Use map() combined with int on the string representation of n and return a list from the result. ... # Define a function 'digitize' that takes an integer 'n' as ...
🌐
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.
🌐
TutorialsPoint
tutorialspoint.com › article › convert-number-to-list-of-integers-in-python
Convert number to list of integers in Python
March 15, 2026 - 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 = [int(digit) for digit in ...
🌐
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 - If we are working with a NumPy array, we can use the tolist() method to convert it into a regular Python list. NumPy arrays are commonly used for numerical data and large datasets.
🌐
DataCamp
datacamp.com › doc › numpy › array-to-list
NumPy Array to List
NumPy provides functionalities for data input/output and conversion, allowing transitions between different data formats. A common operation is converting a NumPy array to a Python list, which can be useful for interoperability with other Python data structures.
🌐
Readthedocs
pythontutorial-wdyds.readthedocs.io › en › latest › 3_Lists_Arrays › lists_arrays.html
4. Lists and Arrays — A Python Tutorial for Data Scientists 2.0 documentation
Just as we saw with other data types, we can attempt to convert variables into a list with the list() function. For some data types, this will simply add a pair of square brackets around your data, but for other data types that you’ll eventually learn about, such as arrays, this type conversion can be more signficant. In particular, Python thinks of lists as collections of stuff so for some data types that can’t really be thought of that way, like a single integer or float, list() will throw a TypeError as you’ll see below.
🌐
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 != '-': ...
🌐
Programiz
programiz.com › python-programming › array
Python Array of Numeric Values
March 26, 2024 - 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. The letter d is a type code.
🌐
GeeksforGeeks
geeksforgeeks.org › python › python-create-list-of-numbers-with-given-range
Create List of Numbers with Given Range - Python - GeeksforGeeks
Explanation: np.arange(r1, r2).tolist() uses NumPy's arange() function to generate a sequence of numbers from r1 o r2 .tolist() method converts the NumPy array into a Python list.
Published: July 11, 2025
🌐
Ducmanhphan
ducmanhphan.github.io › 2022-04-17-how-to-convert-int-to-list-integer
How to convert int[] to List of Integer
Below is the solution that we use stream() method of Arrays class. int[] rawData = {1, 3, 5}; List<Integer> data = Arrays.stream(rawData) // IntStream .boxed() // Stream<Integer> .collect(Collectors.toList());
🌐
LabEx
labex.io › tutorials › python-how-to-generate-a-list-of-integers-between-two-values-in-python-395064
How to generate a list of integers between two values in Python | LabEx
If you're working with the NumPy library, you can use the numpy.arange() function to generate a list of integers. NumPy is a powerful library for scientific computing in Python, and it provides efficient ways to work with arrays and matrices. Here's an example: