Home > Backend Development > Python Tutorial > How to create an empty list in python

How to create an empty list in python

藏色散人
Release: 2019-07-02 14:29:58
Original
23691 people have browsed it

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
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template