Python Learning (iv)

Source: Internet
Author: User
List of additions and deletions to search and change

1. Increase

A, append (): Add at the end of the list

B, insert (INDEX,SELF): Inserts self at the specified index, moves the original position data back

C, Extend (self,iterable): Inserts the iteration of self into the end of the list, and if Self is a list, inserts the list element to the end

2. Delete

A, Pop (index): Remove by index value removes the last one by default

B, remove (self): Remove by value, remove self from list, if not found, error

C, Clear (): Empty list

D, del: Default Delete list, can be deleted by index individual, can also slice delete

3. Enquiry

by looping

4. Change

A, by index

b, by slice, the changed string will be iterated

C, by list, changes the list element in

Nesting of lists

Java-like arrays

A new list is created after the changes are made in the nested, and the new list needs to be assigned to the new list

Ganso

1, read-only list, can be circular query, can be sliced

2, the offspring can not be changed, the sun will change

Conversion of strings and lists

Join list to string, number cannot appear in list, list

Split string goto List

Python Learning (iv)

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.