If you are not satisfied with lists (because they can contain anything and take up too much memory) you can use efficient array of integers:

import array
array.array('i')

See here

If you need to initialize it,

a = array.array('i',(0 for i in range(0,10)))
Answer from yu_sha on Stack Overflow
๐ŸŒ
Python
docs.python.org โ€บ 3 โ€บ library โ€บ array.html
array โ€” Efficient arrays of numeric values
This module defines an object type which can compactly represent an array of basic values: characters, integers, floating-point numbers. Arrays are mutable sequence types and behave very much like lists, except that the type of objects stored ...
๐ŸŒ
Python Examples
pythonexamples.org โ€บ python-create-an-integer-array
Python - Create an Integer Array
To create an integer array in Python, import array module, call array() method of array module, and pass the type code for integer type as first argument and the list of elements for the initial values of array as second argument.
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ python-arrays
Python Arrays - GeeksforGeeks
Array elements are accessed using their index with square brackets [ ]. Each item has a position starting from 0 and the index must be an integer.
Published: 1 week ago
๐ŸŒ
Linode
linode.com โ€บ docs โ€บ guides โ€บ python-arrays
Python Arrays: What They Are and How to Use Them | Linode Docs
June 17, 2022 - When using an array, you can be sure that it only contains the type that was specified upon creation. A single Python list can simultaneously store integers, strings, and dictionaries. You can even add more elements of still other types to an existing list. By contrast, elements in a Python array can only be of one type.
Find elsewhere
๐ŸŒ
Dot Net Perls
dotnetperls.com โ€บ array-python
Python - array Examples - Dot Net Perls
from array import array # Create an int array of three elements. a = array("i", [ ... Suppose you have a large string you want to store in an array. We can use the "u" type code. Here the string "python" is transformed into an array of six Unicode characters.
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ declaring-an-array-in-python
Declaring an Array in Python - GeeksforGeeks
July 10, 2025 - Explanation: array() from the array module creates a typed array in Python. 'i' denotes integer type.
๐ŸŒ
W3Schools
w3schools.com โ€บ python โ€บ python_arrays.asp
Python Arrays
Arrays are used to store multiple values in one single variable.
๐ŸŒ
Quora
quora.com โ€บ How-do-you-create-a-random-integer-array-in-Python
How to create a random integer array 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.
๐ŸŒ
Sentry
sentry.io โ€บ sentry answers โ€บ python โ€บ declare an array in python
Declare an array in Python | Sentry
Python provides an array module that can be used to create lists that can only contain one type of element, though they can also be of arbitrary and varying lengths. from array import array my_int_array = array('i', [1, 2, 3, 4, 5]) # create ...
๐ŸŒ
Toppr
toppr.com โ€บ guides โ€บ python-guide โ€บ references โ€บ methods-and-functions โ€บ array โ€บ python-array-of-numeric-values
Python Array of Numeric Values: Arrays, Creating Python Arrays, Examples
July 14, 2021 - A collection of homogeneous elements or items, that is, values belonging to the same data types is known as an array in Python. If the values entered in the array are of different data types then it will generate an error.
๐ŸŒ
Scribd
scribd.com โ€บ document โ€บ 787105850 โ€บ arrays-in-Python
Python Integer Array Overview | PDF | Integer (Computer Science) | Data Type
arrays in Python - Free download as Word Doc (.doc / .docx), PDF File (.pdf), Text File (.txt) or read online for free.
๐ŸŒ
Python Data Science Handbook
jakevdp.github.io โ€บ PythonDataScienceHandbook โ€บ 02.01-understanding-data-types.html
Understanding Data Types in Python | Python Data Science Handbook
At the implementation level, the array essentially contains a single pointer to one contiguous block of data. The Python list, on the other hand, contains a pointer to a block of pointers, each of which in turn points to a full Python object like the Python integer we saw earlier.
๐ŸŒ
Programiz
programiz.com โ€บ python-programming โ€บ array
Python Array of Numeric Values
So, what are the uses of arrays created from the Python array module? The array.array type is just a thin wrapper on C arrays which provides space-efficient storage of basic C-style data types. If you need to allocate an array that you know will not change, then arrays can be faster and use less memory than lists. Unless you don't really need arrays (array module may be needed to interface with C code), the use of the array module is not recommended.
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ array-python-set-1-introduction-functions
Array Module in Python - GeeksforGeeks
August 2, 2025 - For example: For an array of integers with the int data type, each element of the array will occupy 4 bytes. Elements of array are stored in contiguous memory locations. The array() function from Python's array module creates an array with elements ...