A numpy array is an iterable, you you can easily convert it to a list:

lst = list(A)

Demo:

>>> arr = np.arange(8).reshape(2,2,2)
>>> arr
array([[[0, 1],
        [2, 3]],

       [[4, 5],
        [6, 7]]])
>>> list(arr)
[array([[0, 1],
       [2, 3]]), array([[4, 5],
       [6, 7]])]
Answer from Serge Ballesta on Stack Overflow
🌐
w3resource
w3resource.com › python-exercises › numpy › convert-a-3d-numpy-array-to-a-list-of-lists-of-lists.php
Convert a 3D NumPy array to a list of lists of lists
September 1, 2025 - Write a Numpy program to convert a 3D array to a nested list and then flatten it back while preserving the original 3D shape.
🌐
GeeksforGeeks
geeksforgeeks.org › python › python-creating-3d-list
Python - Creating a 3D List - GeeksforGeeks
December 11, 2024 - The inner loop appends rows to this 2D list. For numerical computations, using NumPy is more efficient and convenient. ... import numpy as np # Create a 3D array with dimensions 2x3x4, initialized to 0 a = np.zeros((2, 3, 4)) print(a) The np.zeros() function creates an array filled with 0 with the specified dimensions. NumPy is optimized for large scale computations and is faster compared to native Python lists.
Discussions

Declaring a 3D array (list?) in Python
First of all, you wouldn't get confused with your bracketing if you wrote it a little differently: int map[2][3][5] = { { {0,0,0,0,0}, {0,0,0,0,0}, {0,0,0,0,0} }, { {0,0,0,0,0}, {0,0,0,0,0}, {0,0,0,0,0} } } Anyway, you basically have two options: Option 1: list of lists of lists x, y, z = 2, 3, 5 map = [] for _ in range(x): sublist = [] for _ in range(y): subsublist = [0] * z sublist.append(subsublist) map.append(sublist) This can be written more compactly using nested list comprehensions: x, y, z = 2, 3, 5 map = [[[0 for c in range(z)] for b in range(y)] for a in range(x)] Doing it this way, your dimensions are fixed size (you'll get IndexError if you try to access invalid indices), but it is non-ideal because it is really a list of lists of lists. You'll have to be careful not to accidentally make multiple references to the same sublists, because that would probably lead to confusing unexpected results. Option 2: dictionary with (x, y, z) tuples as the keys x, y, z = 2, 3, 5 map = {(a, b, c): 0 for a in range(x) for b in range(y) for c in range(z)} # Now access items like map[(2, 3, 5)] # or even map[2, 3, 5] This is nice because the set-up is simpler. The downside is that there's no safeguard against adding new items with out-of-bounds indices. EDIT: Probably a good idea to call this something other than map, because map() is a built-in function that you may find yourself needing to use. More on reddit.com
🌐 r/learnpython
11
9
November 8, 2013
How to convert a Julia 3D array to a Python 3D list
I have a Julia 3D array on the format Vector{Vector{Vector{Float64}}} and I am wondering how I can convert it into a 3D list in Python with the same indexing. Thanks for any help! More on discourse.julialang.org
🌐 discourse.julialang.org
5
0
May 4, 2024
Create 3D array using Python - Stack Overflow
I would like to create a 3D array in Python (2.7) to use like this: More on stackoverflow.com
🌐 stackoverflow.com
What is 3D array in python?
1D Array: a1 = [1,2,3] 2D Array: a2 = [[1,2,3],[4,5,6],[7,8,9]] 3D Array: a3 = [ [ [1,2,3],[4,5,6],[7,8,9] ], [ [1,2,3],[4,5,6],[7,8,9] ], [ [1,2,3],[4,5,6],[7,8,9] ], ] An nD array is just a list of lists of lists n-levels down. Another way to think about is: How many indices do you need to refer to one specific element of the array? That "how many" is your n or dimensionality of the array: a1[0] # 1 index a2[0][1] # 2 indices a3[0][1][2] # 3 indices More on reddit.com
🌐 r/learnpython
10
8
February 19, 2024
🌐
w3resource
w3resource.com › python-exercises › list › python-data-type-list-exercise-13.php
Python: Generate a 3D array - w3resource
June 28, 2025 - Python List Exercises, Practice and Solution: Write a Python program to generate a 3*4*6 3D array whose each element is *.
🌐
Reddit
reddit.com › r/learnpython › declaring a 3d array (list?) in python
r/learnpython on Reddit: Declaring a 3D array (list?) in Python
November 8, 2013 -

Hello friends. I am trying to start to learn Python, but I am having some trouble getting past the early steps. I have a working knowledge of C and have figured out how to transfer most things over to the new syntax, but this one eludes me. I would like to declare a three dimensional array, which I believe may be called a list in Python, similar to this example in C:

int map[2][3][5] = {{
{0,0,0,0,0},
{0,0,0,0,0},
{0,0,0,0,0}},{

{0,0,0,0,0},
{0,0,0,0,0},
{0,0,0,0,0}}}

Please note I may have gotten my bracketing slightly wrong here. I always get confused without a compiler to correct me, but you know what I'm going for - an expandable set of 2D arrays I can define when they are initialized.

My issue is finding documentation that allows me to declare and reference a variable in this way. I need the program to be able to hit specific tiles, such as map[1][2][0] vs. map[1][2][1], and all the information I've found regarding declarations for Python seem to lean towards not defining these borders and having these vaguely long lists that I'm not sure how to manage properly. I thought I might be missing something, possibly searching for the wrong words (Is it called a 3D list? Who knows!) or looking in the wrong areas. If this is an easy thing to look up, I'm sorry, I've tried over and over before posting and I just can't get it to come up with what I need. Any help would be greatly appreciated!

As a final note, this is one of the first things I need to figure out to teach myself Python, so it would be best to assume I have little knowledge of the terminology and syntax. All my programming before this was straight C, not even C++ really, so it is very foreign looking to me.

Top answer
1 of 5
5
First of all, you wouldn't get confused with your bracketing if you wrote it a little differently: int map[2][3][5] = { { {0,0,0,0,0}, {0,0,0,0,0}, {0,0,0,0,0} }, { {0,0,0,0,0}, {0,0,0,0,0}, {0,0,0,0,0} } } Anyway, you basically have two options: Option 1: list of lists of lists x, y, z = 2, 3, 5 map = [] for _ in range(x): sublist = [] for _ in range(y): subsublist = [0] * z sublist.append(subsublist) map.append(sublist) This can be written more compactly using nested list comprehensions: x, y, z = 2, 3, 5 map = [[[0 for c in range(z)] for b in range(y)] for a in range(x)] Doing it this way, your dimensions are fixed size (you'll get IndexError if you try to access invalid indices), but it is non-ideal because it is really a list of lists of lists. You'll have to be careful not to accidentally make multiple references to the same sublists, because that would probably lead to confusing unexpected results. Option 2: dictionary with (x, y, z) tuples as the keys x, y, z = 2, 3, 5 map = {(a, b, c): 0 for a in range(x) for b in range(y) for c in range(z)} # Now access items like map[(2, 3, 5)] # or even map[2, 3, 5] This is nice because the set-up is simpler. The downside is that there's no safeguard against adding new items with out-of-bounds indices. EDIT: Probably a good idea to call this something other than map, because map() is a built-in function that you may find yourself needing to use.
2 of 5
4
n-dimensional arrays in python can be represented as just lists of lists. Are you familiar with how to make a single list?
🌐
EDUCBA
educba.com › home › software development › software development tutorials › python tutorial › 3d arrays in python
3d Arrays in Python | How to Create,Insert And Remove 3D Array In Python
April 23, 2024 - And the answer is we can go with the simple implementation of 3d arrays with the list. But for some complex structures, we have an easy way of doing it by including Numpy. It is not recommended which way to use it. It depends on the project and requirement of how you want to implement a particular functionality. Python has a set of libraries defines to ease the task.
Address: Unit no. 202, Jay Antariksh Bldg, Makwana Road, Marol, Andheri (East),, 400059, Mumbai
🌐
Julia Programming Language
discourse.julialang.org › new to julia
How to convert a Julia 3D array to a Python 3D list - New to Julia - Julia Programming Language
May 4, 2024 - I have a Julia 3D array on the format Vector{Vector{Vector{Float64}}} and I am wondering how I can convert it into a 3D list in Python with the same indexing. Thanks for any help!
Find elsewhere
🌐
Python Guides
pythonguides.com › python-numpy-3d-array
3D Arrays In Python Using NumPy
May 16, 2025 - import numpy as np # Create a 3D array with zeros - great for initializing zeros_array = np.zeros((2, 3, 4)) # 2 matrices, 3 rows, 4 columns # Create a 3D array with ones ones_array = np.ones((2, 3, 4)) # Create a 3D array with random values random_array = np.random.rand(2, 3, 4) # Create from nested lists list_array = np.array([ [[1, 2], [3, 4]], [[5, 6], [7, 8]], [[9, 10], [11, 12]] ]) print(f"Shape of array: {list_array.shape}") ... I expected the above example code and added the screenshot below. Using NumPy to work with 3D arrays ensures better performance and easier manipulation compared to plain Python lists
🌐
Python Like You Mean It
pythonlikeyoumeanit.com › Module3_IntroducingNumpy › AccessingDataAlongMultipleDimensions.html
Accessing Data Along Multiple Dimensions in an Array — Python Like You Mean It
Suppose we want the scores of all the students for Exam 2. We can slice from 0 through 3 along axis-0 (refer to the indexing diagram in the previous section) to include all the students, and specify index 1 on axis-1 to select Exam 2: >>> grades[0:3, 1] # Exam 2 scores for all students array([ 95, 100, 87]) As with Python sequences, you can specify an “empty” slice to include all possible entries along an axis, by default: grades[:, 1] is equivalent to grades[0:3, 1], in this instance.
🌐
YouTube
youtube.com › watch
3 Dimensional Lists - Python - YouTube
----------Python Tutorials: https://www.youtube.com/playlist?list=PL1Z6aLHzUlXoq-DOKFMYC-0nv4L7S24DwProduct Reviews & Unboxings: https://youtube.com/playlist
Published: August 13, 2023
🌐
Delft Stack
delftstack.com › home › howto › python › declare 3d array in python
How to Declare 3D Array in Python | Delft Stack
February 2, 2024 - There are 3 main methods that can be used to declare a 3D array in Python, the list comprehensions, the multiplication method, and the numpy package.
🌐
TutorialsPoint
tutorialspoint.com › article › python-program-to-create-3d-list
Python program to create 3D list.
March 24, 2026 - 3D array using NumPy: [[[0 0 0 0] [0 0 0 0] [0 0 0 0]] [[0 0 0 0] [0 0 0 0] [0 0 0 0]]] 3D array with sequential numbers: [[[ 1 2 3 4] [ 5 6 7 8] [ 9 10 11 12]] [[13 14 15 16] [17 18 19 20] [21 22 23 24]]] Python offers multiple ways to create 3D lists: nested loops for clarity, list comprehension for conciseness, and NumPy for advanced mathematical operations.
🌐
YouTube
youtube.com › shorts › fou9wRcWI94
Python 3D Array with List Comprehension #shorts - YouTube
Python 3D Array with List Comprehension #shorts Learn PythonPython programmingNumpyNympy arrays3 D arraysPython 3 dimension arraysLinear Algebra with PythonP...
Published: February 4, 2023
🌐
SciPy
docs.scipy.org › doc › numpy-1.13.0 › reference › generated › numpy.ndarray.tolist.html
numpy.ndarray.tolist — NumPy v1.13 Manual
June 10, 2017 - Return a copy of the array data as a (nested) Python list. Data items are converted to the nearest compatible Python type.
🌐
Medium
medium.com › @bouimouass.o › what-3d-arrays-look-like-some-ways-to-construct-them-and-their-applications-5f054ce9adb8
What 3D arrays look like, some ways to construct them and their applications? | by Omar | Medium
July 23, 2023 - There are three ways to construct 3D arrays in Python: Using the array() function · Using the reshape() function · Using nested lists ·
🌐
Quora
quora.com › How-can-you-create-an-array-3D-in-Python
How to create an array 3D in Python - Quora
Answer: In Python, you can create a 3D array using lists or, preferably, NumPy arrays. NumPy is a powerful library for numerical operations, and it provides convenient functions for working with multi-dimensional arrays. Here's how you can create a 3D array using NumPy:
🌐
Medium
medium.com › @girginlerheryerde › layer-by-layer-understanding-3d-arrays-in-python-a5709b7ef8d1
Layer by Layer: Understanding 3D Arrays in Python | by Ayşenas Girgin | Medium
March 17, 2025 - The syntax for accessing elements is straightforward · This accesses the element in the second layer, third row, fourth column. The concept is simple once you internalize the order: Layer → Row → Column. To process every element in a 3D ...