A simple way to create an empty list in Python is by just placing the sequence inside the square brackets[ ]. Don’t add any value just assign a variable with square brackets.
A declaration of an empty list
List = 
Python creates an empty list Example
Simple Python program to declare empty list.
list1 =  print("Values of a:", list1) print("Type of a:", type(list1)) print("Size of a:", len(list1))
Another way Using list() constructor
The list() constructor is used to create an empty list in Python.
a = list() print("Values of a:", a)
Output: Values of a: [ ]
Q: What is the best way to create a new empty list in Python?
list() is inherently slower than
- there is symbol lookup (no way for python to know in advance if you did not just redefine list to be something else!),
- there is function invocation,
- then it has to check if there was iterable argument passed (so it can create list with elements from it) ps. none in our case but there is “if” check
Do comment if you have any doubts and suggestions on this Python list topic.
Note: IDE: PyCharm 2021.1.3 (Community Edition)
All Python Examples are in Python 3, so Maybe its different from python 2 or upgraded versions.
Degree in Computer Science and Engineer: App Developer and has multiple Programming languages experience. Enthusiasm for technology & like learning technical.