Join, set set, dark copy in Python

Source: Internet
Author: User
Tags set set shallow copy

A. Join
1. The join method in Str. Convert a list to a string
2. Lists and dictionaries cannot be deleted directly in the loop.
You need to record the content you want to delete in the new list.
The new list is then recycled. Delete a dictionary or list
3. Fromkeys ()
1. Return to the new dictionary. No effect on the original dictionary
2. The following value. Is multiple keys share a value
Two. Set Set
Features: unordered, non-repeating, elements must be hashed (immutable)
Function: To repeat
itself is a mutable data type. There is an increase and deletion check operation.
Frozenset () freezes the collection. Immutable. Hash-able
Three. Depth copy (difficulty)
1. Assign a value. No new objects were created. Common same Object
2. Shallow copy. Copy the first layer of content. [:] or copy ()
3. Deep copy. Copy all content. including all the inside.

Join, set set, dark copy in Python

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.