Python list common ways to organize

Source: Internet
Author: User
Tags python list

1.append (obj) adds an object to the list obj

2.count (obj) returns the number of occurrences of an object, obj, in the list.

3.extend (SEQ) adds the contents of the sequence SEQ to the list.

4.index (obj,i=0, J=len (list)) returns the value of list[k] = = obj, and the range of K is at I <= K < J; otherwise a ValueError exception is thrown.

5.insert (Index,obj) Inserts the object obj at the index position.

6.pop (index=-1) deletes and returns the object at the specified position, which is the last object by default

7.remove (obj) removes an object from the list obj

8.reverse () Flips the list in place.

9.sort (Func=none,key = none,resverse=false) Sorts the members in the list in the specified manner, if the Func and key parameters are braked, the individual elements are compared in the specified manner, and if the reverse flag is set to True, The list is ordered in reverse order.

Python list common ways to organize

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.