I also don't recommend this, but you could use a numpy.chararray for this:

import numpy as np
arr = np.chararray((100, 12, 31, 24, 60, 60), itemsize=100)

arr[52, 7, 12, 12, 44, 54] = 'year 1950+52, 7th month, 12th day, 12th hour, 44th minute, 54th second'

I'm not exactly sure what your desired structure is, but the string I inserted into the array should explain the structure I proposed, and you can change it however you need. Note that itemsize limits how many characters you can put in at any index.

Again, with a caveat that this is not necessarily the most efficient thing in the world to do, but if you wish to store lists of ints and/or floats in that array (as per your comment), one way to do it would be to convert that list to strings, and then when retrieving it, re-transform back to a list:

data_to_insert = [1,2,3,4.5]
# store as string
arr[52, 7, 12, 12, 44, 54] = ','.join(map(str, data_to_insert))
# retrieve
arr[52, 7, 12, 12, 44, 54].decode('utf-8').split(',')

This should be pretty fast

Answer from sacuL on Stack Overflow
Top answer
1 of 2
2

I also don't recommend this, but you could use a numpy.chararray for this:

import numpy as np
arr = np.chararray((100, 12, 31, 24, 60, 60), itemsize=100)

arr[52, 7, 12, 12, 44, 54] = 'year 1950+52, 7th month, 12th day, 12th hour, 44th minute, 54th second'

I'm not exactly sure what your desired structure is, but the string I inserted into the array should explain the structure I proposed, and you can change it however you need. Note that itemsize limits how many characters you can put in at any index.

Again, with a caveat that this is not necessarily the most efficient thing in the world to do, but if you wish to store lists of ints and/or floats in that array (as per your comment), one way to do it would be to convert that list to strings, and then when retrieving it, re-transform back to a list:

data_to_insert = [1,2,3,4.5]
# store as string
arr[52, 7, 12, 12, 44, 54] = ','.join(map(str, data_to_insert))
# retrieve
arr[52, 7, 12, 12, 44, 54].decode('utf-8').split(',')

This should be pretty fast

2 of 2
2

Though i won't recommend it, A multi dimentional empty list can be created by using list comprehension:

> >>> a = 4 #Width of elements
> >>> b = 6 #Width of main list container
>>>>> c = 4
>>>>> d = 3
> >>> l = [[[[0 for k in range(d) ] for z in range(c)] for x in range(a)] for y in range(b)]
> >>> [[[[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], [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]], [[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], [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]], [[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], [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]], [[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], [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]]], [[[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], [0, 0, 0], [0, 0, 0]], [[0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0]]]]

Keep replacing 0 with list comprehensions to add more dimentions.

🌐
Quora
quora.com › How-do-you-create-an-empty-multidimensional-array-in-Python
How to create an empty multidimensional array in Python - Quora
Answer (1 of 5): You can’t - a multidimensional list (not array) in Python is a list of lists. if the top level list is empty then it isn’t multidimensional - it is an empty list. if the list on the next level down are empty then you have a list which is N by zero - hardly multi-dimensional.
🌐
GitHub
gist.github.com › gonzacaminos › 16c830ffda05128a3481ea86ddd0024c
Create an empty multidimensional list in Python · GitHub
Create an empty multidimensional list in Python. GitHub Gist: instantly share code, notes, and snippets.
🌐
w3resource
w3resource.com › python-exercises › list › python-data-type-list-exercise-85.php
Python: Create a multidimensional list with zeros - w3resource
June 28, 2025 - Write a Python program to create a multidimensional list (lists of lists) with zeros. Visual Presentation: Sample Solution: Python Code: # Create an empty multidimensional list 'nums' nums = [] # Loop over a range of 3 times to create 3 sublists for i in range(3): # Append an empty sublist to 'nums' for each iteration nums.append([]) # Loop over a range of 2 times to fill each sublist with 2 zeros for j in range(2): # Append a zero to the current sublist for each iteration nums[i].append(0) # Print a message indicating the resulting multidimensional list print("Multidimensional list:") # Print the 'nums' list containing the structure of zeros print(nums) Sample Output: Multidimensional list: [[0, 0], [0, 0], [0, 0]] Flowchart: For more Practice: Solve these Related Problems: Write a Python program to create a multidimensional list of ones.
🌐
DaniWeb
daniweb.com › programming › software-development › threads › 160559 › empty-2d-array
python - Empty 2D Array [SOLVED] | DaniWeb
December 3, 2008 - If your data are sparse (many empty cells), a dictionary keyed by (row, col) avoids allocating full rows: from collections import defaultdict grid = defaultdict(dict) grid[r][c] = value # only store populated cells · For heavy numeric work, prefer NumPy arrays for performance and vectorization; initialize once you know dimensions: arr = numpy.zeros((rows, cols)) (NumPy zeros). More on the aliasing gotcha: Python FAQ: multidimensional lists.
🌐
Statistics Globe
statisticsglobe.com › home › python programming language for statistics & data science › create empty 2d list in python (2 examples)
Create Empty 2D List in Python (2 Examples) | Zero Elements
March 31, 2023 - How to make an empty 2D list in the Python programming language - Make empty 2D list using nested for loop - Python coding tutorial
🌐
Ubaldo Acosta Soto
ictdemy.com › python › basics › multidimensional-lists-in-python
Lesson 10 - Multidimensional lists in Python - ICTdemy.com
We have to keep in mind the outer list can be empty. We'll nest the loops in order so that the outer loop iterates over the rows and the inner one over the columns of the current row.
Find elsewhere
🌐
Snakify
snakify.org › two-dimensional lists (arrays)
Two-dimensional lists (arrays) - Learn Python 3 - Snakify
A possible way: you can create ... one-dimensional list of m elements: ... Another (but similar) way: create an empty list and then append a new element to it n times (this element should be a list of length m):...
🌐
Python Guides
pythonguides.com › create-an-empty-array-in-python
Ways to Initialize an Empty Python Array
January 12, 2026 - If I am processing a list of zip codes from the United States Census Bureau, I use the Python array module to save memory. import array # Creating an empty Python array of integers ('i' represents signed integers) # This is useful for memory-efficient storage of USA Zip Codes zip_codes = array.array('i') print(f"Empty Python Array: {zip_codes}") # Adding a Beverly Hills zip code zip_codes.append(90210) print(f"Updated Python Array: {zip_codes}")
🌐
Quora
quora.com › How-do-you-create-an-empty-2D-list-in-Python
How to create an empty 2D list in Python - Quora
Answer (1 of 10): C̲r̲e̲a̲t̲i̲n̲g̲ ̲a̲n̲ e̲m̲p̲t̲y̲ ̲2̲D̲ ̲li̲s̲t̲ ̲i̲n̲ ̲P̲y̲t̲h̲o̲n̲ ̲i̲s̲ ̲s̲t̲r̲a̲i̲g̲h̲t̲f̲o̲r̲w̲ar̲d̲ ̲,̲ ̲b̲u̲t̲ ̲u̲n̲d̲e̲r̲s̲t̲a̲n̲di̲n̲g̲ ̲t̲h̲e̲ ̲n̲u̲a̲n̲c̲e̲s̲ ̲e̲ns̲u̲r̲e̲s̲ ...
🌐
Brainly
brainly.com › computers and technology › college › complete the code to create a multidimensional list. ```python listb = [] listb.append([4, 6, 8, 10]) ```
[FREE] Complete the code to create a multidimensional list. python listB = [] listB.append([4, 6, 8, 10]) - brainly.com
December 14, 2024 - To complete the code to create a multidimensional list in Python, follow these steps: Initialize an Empty List: You can start with an empty list, just like you've done with listB = []. This list will hold other lists, creating a multidimensional ...
🌐
Ubuntu Forums
ubuntuforums.org › archive › index.php › t-950128.html
Python empy three-dimensional lists [Archive] - Ubuntu Forums
October 17, 2008 - This isn't aesthetically pleasing, but I just implemented the following: vals = [] for i in range(len(phidict)): vals.append([]) for j in range(len(yeardict)): vals[i].append([]) for k in range(7): vals[i][j].append([]) Perhaps not the best python solution, but for a c-coder like myself, it did the trick. Yeah, no kidding, I could smell C programmer from here. Btw, what is that supposed to be? yeardict? timedate module not good enough? ... curlyNY has got it right. I have recently tried to do this and you can't just declare 2d lists like that, you have to iterate through them.
🌐
GeeksforGeeks
geeksforgeeks.org › python-using-2d-arrays-lists-the-right-way
Python | Using 2D arrays/lists the right way - GeeksforGeeks
Manually initializing and populating a list without using any advanced features or constructs in Python is known as creating a 1D list using "Naive Methods". ... Here we are multiplying the number of rows by the empty list and hence the entire ...
Published: June 20, 2024