initialize list of empty lists python code example
Example 1: initialize a list of list in python
x = [[] for i in range(3)]
Example 2: python initialise list of lists
# initialise a list of n lists
n = 3
x = [[] for i in range(n)]
x = [[] for i in range(3)]
# initialise a list of n lists
n = 3
x = [[] for i in range(n)]