Python Note-set

Source: Internet
Author: User

Coding
Unicode, universal code, Unified code, for each language of each character set a unified and unique binary encoding, to meet cross-platform, cross-language text conversion;

Utf-8-8-bit Unicode Transformation Format, variable-length character encoding for Unicode

ASCII code: American Standard Code for information interchange, U.S. Standards for Information interchange codes

gbk-Chinese Character Coded charset
Hash table-is a data structure that is accessed directly based on key value
Objects are created with classes;
How many methods the class has, how many functions the object has

Set set, which does not allow duplicate elements to appear
Fast access to solve repetitive problems
Create: Create by class
S1 = set ()
S1.add (' AAA ')
Print (S1)
S1.add (' CCC ')
Print (S1)
Crawler: Request the page, get the source code, take the element, find the product name, find the price
Crawler has the entrance, find all the links, access to put set inside
Finally, you can determine if there is a URL in set.

CMDB: Acquiring hardware assets
Intersection, Difference set
S1 = set ([11,22,33])
S2 = set ([44,55])

S3 = s1.difference (S2)
S4 = s1.difference_update (S2)
S5 = s1.symmetric_difference (S2)
Print (S3)
Print (S4)
Print (S5)

Collections Series, Collection
The Counter counter, which complements the dictionary type and counts the number of occurrences of a value, inherits the collection class
A = collections. Counter (' Aaaafdsfdsfsdfds ')
Print (a)

Counter ({' A ': 4, ' F ': 4, ' d ': 4, ' s ': 4})

Ordered dictionary Ordereddict

Python Note-set

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.