List type of Python data structure

Source: Internet
Author: User

List type of data structure

List description

add element to List

To delete a list element

Change list elements

View list elements

List script operators

List interception and splicing

Nested lists

List built-in functions

I. Description of the list

The sequence is the most basic data structure in Python. Each element in the sequence is assigned a number-its position, or index, the first index is 0, the second index is 1, and so on.

Python has 6 built-in types of sequences, but the most common are lists and tuples.

Sequences can be performed by operations including indexing, slicing, adding, multiplying, and checking members.

Python has built-in methods for determining the length of a sequence and determining the maximum and minimum elements

Data items for a list do not need to have the same type

Create a list by enclosing separate data items separated by commas in square brackets. As shown below:

>>> li = ["zjk", 123,"python"]>>> Li2 = [1,2,3,4,5]>>> li3 = ["a","b" ,"C"]

Second, add elements to the list

List type of Python data structure

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.