Home >Backend Development >Python Tutorial >Python List
In python it means that a list which is empty.
packages=[] ''
List means there are many things which are there in the list.
eg:
list
123
235
574
665
eg:
packages=["fruits","vegetables","notebooks"]
eg:
packages=["fruits","vegetables","notebooks"] item=packages[1] 'fruits'
eg:
packages=["fruits","vegetables","notebooks"] packages.append("pencils") packages=["fruits","vegetables","notebooks","pencils"]
eg:
packages=["fruits","vegetables","notebooks","pencils"] packages.remove("fruits") packages=["vegetables","notebooks","pencils"]
eg:
packages=["vegetables","notebooks","pencils"] last_package=packages.pop packages=["vegetables","notebooks"]
eg:
packages=["vegetables","notebooks"] position=packages.index("vegetables") '1'
It used to use the list in alphabetical order.
eg:
packages=["fruits","vegetables","notebooks","pencils"] packages.sort() ["fruits","notebooks","pencils","vegetables"]
This things and all I learn in my class.
Thank You.
S. Kavin
The above is the detailed content of Python List. For more information, please follow other related articles on the PHP Chinese website!