Setting/initializing a list of certain length

Published: Wednesday, Dec 26, 2007 Last modified: Saturday, Mar 23, 2024

Another tip from deltab_ from #python.

>>> l = [0] * 5

>>> l

[0, 0, 0, 0, 0]