Get the App
SLTechnology News&Howtos  ›  Development  › 

How to parse python lists and arrays

Shulou Source: shulou.com Published: 2022-06-02 23:36:34 09月29日 Update

This article shows you how to parse python lists and arrays. The content is concise and easy to understand. It will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.

The list List is more like an array in JAVA, but it is much more powerful than an array in JAVA. Similar to the ArrayList class, it can save any object and can be dynamically extended as new elements are added.

I.

Define

Li = ["a", "b", "c"]

One thing to note is that the list starts with a 0 subscript! Negative index:

Print li [- 1]

Print out c negative index to access elements by counting forward from the tail of list

II. Slicing

Print li [0:2]

Output: ['a','b'] is equivalent to a value of

0

Tags: Element array content dynamic function that is skill knowledge index output powerful concise concise subscript location object tail article more abbreviation Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS Microsoft NVidia MySQL OPPO Reno