Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use python list

Shulou Source: shulou.com Published: 2022-06-03 17:38:18 09月28日 Update

This article mainly shows you "how to use the python list", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "how to use the python list" this article.

1. A list is a list of elements separated by commas between square brackets [].

The feature types can be different or nested.

2. Lists can be concatenated and intercepted like strings. Intercept and return a new list. The tail is also not included.

3. The elements in the list can be changed.

Example

Example: list = [123,123,2.23,456, "efg"] tinylist = [123,' runoob'] print (list) / / output [123,' abcd', 2.23,[ 456, 'efg']] print (list [0]) / / output 123print (list [3]) / / output [456] 'efg'] print (list [0:3]) / / output [123,' abcd', 2.23] print (list * 2) / / output [123,' abcd', 2.23,123,' abcd', 2.23,123, 'abcd', 2.23, [456,' efg']] print (list + [789, "qwe"]) / / output [123,' abcd', 2.23, [456 'efg'], 789,' qwe'] these are all the contents of the article "how to use the python list" Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Tags: Output content articles elements learning help differences between elements characters strings examples square brackets easy to understand more organization knowledge type tape industry Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Technology vpn Redmi Microsoft Docker