Categories
Python Answers

How to create an empty list in Python with certain size?

Spread the love

To create an empty list in Python with certain size, we can create a list with all None with the given size.

For instance, we write

l = [None] * 10

to create list l of size 10 that has all None‘s inside.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *