Python List of Functions & methods detailed

Source: Internet
Author: User
Tags python list
This article is mainly to share with you the Python list of functions & methods in detail, I hope to help everyone.

Python list Functions & methods

Python contains the following functions:

Serial Number function
1 CMP (List1, List2)
Compare two elements of a list
2 Len (list)
Number of list elements
3 Max (list)
Returns the maximum value of a list element
4 MIN (list)
Returns the minimum value of a list element
5 List (seq)
Convert a tuple to a list

Python contains the following methods:

Serial Number Method
1 List.append (obj)
Add a new object at the end of the list
2 List.count (obj)
Count the number of occurrences of an element in a list
3 List.extend (seq)
Append multiple values from another sequence at the end of the list (extend the original list with a new list)
4 List.index (obj)
Find the index position of the first occurrence of a value from the list
5 List.insert (index, obj)
Inserting an object into a list
6 List.pop (Obj=list[-1])
Removes an element from the list (the last element by default), and returns the value of the element
7 List.remove (obj)
To remove the first occurrence of a value in a list
8 List.reverse ()
Reverse List of elements
9 List.sort ([func])
Sort the original list

Related recommendations:

List of Python lists

You should know the Python list to redo method

How arrays in the Python list are referenced

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: info-contact@alibabacloud.com 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.