You do not "declare" arrays or anything else in python. You simply assign to a (new) variable. If you want a multidimensional array, simply add a new array as an array element.

arr = []
arr.append([])
arr[0].append('aa1')
arr[0].append('aa2')

or

arr = []
arr.append(['aa1', 'aa2'])
Answer from ThiefMaster on Stack Overflow
🌐
GeeksforGeeks
geeksforgeeks.org › python › appending-to-2d-list-in-python
Appending to 2D List in Python - GeeksforGeeks
July 23, 2025 - This modifies the contents of the sublist while keeping the 2D structure intact. += operator allows you to extend a sublist with multiple elements in a concise manner. ... This is equivalent to using extend(). If we want to append multiple sublists dynamically list comprehension is a concise option. ... List comprehension generates sublists dynamically and appends them to the original list.
Discussions

do you guys know how to add append an array in a 2d array?
my_list = [[1, 2, 3, 4, 5]] new_list = my_list * 5 print(new_list) Prints: [[1, 2, 3, 4, 5], [1, 2, 3, 4, 5], [1, 2, 3, 4, 5], [1, 2, 3, 4, 5], [1, 2, 3, 4, 5]] But be aware that this only creates multiple labels to the same [1, 2, 3, 4, 5] list object. Mutating any one of the inner lists mutates all of the inner lists as there is only one inner list object: new_list[0][0] += 40 print(new_list) print(my_list) # The original list object Prints: [[41, 2, 3, 4, 5], [41, 2, 3, 4, 5], [41, 2, 3, 4, 5], [41, 2, 3, 4, 5], [41, 2, 3, 4, 5]] [[41, 2, 3, 4, 5]] but you can reassign different objects within new_list: new_list[1] = [7,8,9] print(new_list) Prints: [[41, 2, 3, 4, 5], [7, 8, 9], [41, 2, 3, 4, 5], [41, 2, 3, 4, 5], [41, 2, 3, 4, 5]] If you actually want deep copies of the original inner list, you can use a list comprehension: my_list = [[1, 2, 3, 4, 5]] new_list = [my_list[0][:] for _ in range(5)] new_list[0][0] += 40 print(new_list) Prints: [[41, 2, 3, 4, 5], [1, 2, 3, 4, 5], [1, 2, 3, 4, 5], [1, 2, 3, 4, 5], [1, 2, 3, 4, 5]] More on reddit.com
🌐 r/learnpython
5
5
February 19, 2024
How to append new rows to 2d array python - Stack Overflow
Is there any way to append new rows with the value initialized to zero to a 2d array in python? I have a 2d array: [['a', 'b', 'c'], ['d' 'e', 'f']] Im looking for a way to expand the array so tha... More on stackoverflow.com
🌐 stackoverflow.com
How to add elements in a 2D array in Python - Stack Overflow
To be honest, i don't really know how to properly explain what i want, so i better show it. Basically what i want to do is add elements from 2 different 2D lists a = [[5, 4, 5, 4], [4, 5, 6, 8]] ... More on stackoverflow.com
🌐 stackoverflow.com
Appending to 2D lists in Python - Stack Overflow
this is the most bizarre functionality ... in Python. seems almost like a bug. 2021-11-22T22:26:19.01Z+00:00 ... Save this answer. ... Show activity on this post. ... In other words, all three list references refer to the same list instance. ... Save this answer. ... Show activity on this post. Came here to see how to append an item to a 2D array, but the title ... More on stackoverflow.com
🌐 stackoverflow.com
🌐
Delft Stack
delftstack.com › "delft stack" › "howto" › "python tutorial: how-to guides for everyday python problems" › "how to append 2d array in python"
How to Append 2D Array in Python | Delft Stack
February 22, 2025 - Python’s built-in lists can represent 2D arrays as lists of lists. The simplest way to append values is using the append() method.
🌐
Reddit
reddit.com › r/learnpython › do you guys know how to add append an array in a 2d array?
r/learnpython on Reddit: do you guys know how to add append an array in a 2d array?
February 19, 2024 -

say i have array [[1,2,3,4,5]], how can i duplicate it 5 times to [[1,2,3,4,5],[1,2,3,4,5],[1,2,3,4,5],[1,2,3,4,5],[1,2,3,4,5]] ?

🌐
CodeRivers
coderivers.org › blog › append-to-a-2d-array-python
Appending to a 2D Array in Python — CodeRivers
For example: ... Here, two_d_array is a 2D array with 3 rows and 3 columns. Each inner list represents a row, and the elements within the inner list are the columns of that row. The simplest way to append to a 2D array in Python is by using the built-in append method of lists.
🌐
AskPython
askpython.com › python › two-dimensional-array-in-python
Two Dimensional Array in Python - AskPython
December 27, 2019 - ... size = int(input()) array_input ... ... Elements in a 2D array can be inserted using the insert() function specifying the index/position of the element to be inserted....
🌐
EyeHunts
tutorial.eyehunts.com › home › python 2d array append
Python 2D array append
June 27, 2023 - # Initialize a 2D array array_2d = [[1, 2, 3], [4, 5, 6]] # Append a new row to the 2D array new_row = [7, 8, 9] array_2d.append(new_row) # Append elements to an existing row in the 2D array existing_row_index = 1 array_2d[existing_row_index].append(7) array_2d[existing_row_index].append(8) # Print the modified 2D array for row in array_2d: print(row)
Find elsewhere
🌐
DataCamp
datacamp.com › doc › numpy › append
NumPy append()
This operation is useful when you need to expand the contents of an array dynamically. The `append()` function is typically used when you want to add more data to an array without altering the original array.
🌐
DigitalOcean
digitalocean.com › community › tutorials › python-add-to-array
Python Array Add: How to Append, Extend & Insert Elements | DigitalOcean
June 12, 2026 - Learn how to add to an array in Python with append(), extend(), insert(), and NumPy. Compare lists vs arrays, avoid common errors, and see tested examples.
🌐
GeeksforGeeks
geeksforgeeks.org › python › numpy-append-python
numpy.append() in Python - GeeksforGeeks
April 14, 2025 - When working with multi-dimensional arrays you can specify the axis parameter to control how the values are appended. Python · import numpy as geek arr1 = geek.arange(8).reshape(2, 4) print("2D arr1 :", arr1) print("Shape :", arr1.shape) arr2 = geek.arange(8, 16).reshape(2, 4) print("2D arr2:", arr2) print("Shape :", arr2.shape) arr3 = geek.append(arr1, arr2) print("Appended arr3 by flattened :", arr3) arr3 = geek.append(arr1, arr2, axis = 0) print("Appended arr3 with axis 0 :", arr3) arr3 = geek.append(arr1, arr2, axis = 1) print("Appended arr3 with axis 1 :", arr3) Output : Appending 2D Array ·
🌐
Statistics Globe
statisticsglobe.com › home › python programming language for statistics & data science › append to 2d list in python (3 examples)
Append to 2D List in Python (3 Examples)
April 5, 2023 - How to add a new element to a 2D list in Python - Create demo 2D list - Add new element to 2D list using append() method
🌐
Note.nkmk.me
note.nkmk.me › home › python › numpy
NumPy: append() to add values to an array | note.nkmk.me
February 4, 2024 - By default, when the first argument is a two-dimensional array, it is flattened to one dimension, and then the values from the second argument are appended to it. a_2d = np.arange(6).reshape(2, 3) print(a_2d) # [[0 1 2] # [3 4 5]] ...
🌐
Python Forum
python-forum.io › thread-16863.html
2D arrays and appending values using a loop
Hi, I need some help with the appending of the values into the 2D array using a FOR loop. I am ok with printing the values, its the append that I need help with: Array=[[100,20],[90,29],[102,89],[2,2]] for row in Array: print ('Row Values:',...
🌐
Iditect
iditect.com › faq › python › appending-to-2d-lists-in-python.html
Appending to 2D lists in Python
matrix = [[1, 2, 3], [4, 5, 6]] new_row = [7, 8, 9] matrix.append(new_row) "Python extend 2D list" Description: This query involves extending a 2D list in Python with additional elements.
🌐
Stack Overflow
stackoverflow.com › questions › 62939358 › append-data-in-2-dimensional-array-through-for-loop
python - Append data in 2 dimensional array through for loop - Stack Overflow
July 16, 2020 - arr1[i][j] is selecting a single value, which you are then trying to append to, throwing the error. Try print(arr1[i][j]) to see this in action · G. Anderson – G. Anderson · 2020-07-16 16:39:18 +00:00 Commented Jul 16, 2020 at 16:39 · Use arr1[i][j] = x, if you want to assign to a position. ... @Austin, yes it workes but the values get added from 1st row. So 0th row is "NaN". Any suggestions for that ? ... The function call is not represented as a member function of numpy array.
🌐
NumPy
numpy.org › doc › 2.2 › reference › generated › numpy.append.html
numpy.append — NumPy v2.2 Manual
>>> np.append([[1, 2, 3], [4, 5, 6]], [[7, 8, 9]], axis=0) array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) >>> np.append([[1, 2, 3], [4, 5, 6]], [7, 8, 9], axis=0) Traceback (most recent call last): ...
🌐
w3resource
w3resource.com › numpy › manipulation › append.php
Numpy: numpy.append() function - w3resource
April 25, 2026 - NumPy Array manipulation: numpy.append() function, example - The append() function is used to append values to the end of an given array.