To create an empty list in Python with certain size, we can use the *
operator.
For instance, we write:
l = [None] * 10
print(l)
We create a list with 10 None
entries with [None] * 10
.
Therefore, l
is [None, None, None, None, None, None, None, None, None, None]
.