Home >Backend Development >Python Tutorial >How to create an empty list in python
Python List (List) is the most basic data structure in Python. Each element in the sequence is assigned a number - its position, or index, with the first index being 0, the second index being 1, and so on.
How to create an empty list in python?
Python creates an empty list:
Creation of an empty list:
l = list()
Or:
l = []
Creation and expression of elements in list
fruits = ['apple', 'banana', 'pear', 'grapes', 'pineapple', 'watermelon'] fruits[2] #从0开始数起,第三个元素 pear
Related recommendations: "Python Tutorial"
The above is the detailed content of How to create an empty list in python. For more information, please follow other related articles on the PHP Chinese website!