Python ProgrammingPython Programming

Create an empty list in Python with certain size

from itertools import repeat

thelist = [[[]] for i in repeat(None, 5)]
print(thelist)

empty_list = [[] for x in range(5)]
print(empty_list)

thelst = [None] * 10
print(thelst)
Output
[[[]], [[]], [[]], [[]], [[]]]
[[], [], [], [], []]
[None, None, None, None, None, None, None, None, None, None]