Python standard library: Built-in function Frozenset ([iterable])

Source: Internet
Author: User
Tags iterable

This function returns a frozen collection. The so-called freeze is that this collection can no longer add or remove elements from any collection. So the difference between set and set is that set is the element that can be added or deleted, and frozenset not. The main function of Frozenset is fast, which is realized by using hash algorithm. The parameter iterable is an object that represents an iteration, such as a list, a dictionary, a tuple, and so on.

Example:

#frozenset () L = [1, 2, 3, 4, 5, 6, 6, 7, 8, 8, 9]print (Len (L), l) set = Frozenset (l) print (Len (set), set)

The resulting output is as follows:

11 [1, 2, 3, 4, 5, 6, 6, 7, 8, 8, 9]

9 Frozenset ({1, 2, 3, 4, 5, 6, 7, 8, 9})


Cai Junsheng qq:9073204 Shenzhen


Python standard library: Built-in function Frozenset ([iterable])

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.