Set: It combines different elements to form a set, which is the basic data type of python. Collection classification: mutable set (set), immutable set (frozenset), the creation method is the same. Collection characteristics: disordered, unique, fast 1. Create a set>>> s =set('ian')> >> s{'a', 'n', 'i'}>>> len(s)3>>> li =['apple','pear','peach']> ;>> s =set(li)>>> s{'peach', 'pear','apple'}>>> len(s)3 2. Accessing the collection Since the collection itself is Unordered, so it cannot be a set
1. Basic content of Python: Set
Introduction: Set: It combines different elements to form a set, which is the basic data type of python. Collection classification: mutable set (set), immutable set (frozenset), the creation method is the same. Collection characteristics: disordered, unique, fast 1. Create a set>>> s =set('ian')> >> s{'a', 'n', 'i'}>>> len(s)3>>> li =['apple','pear','peach']> ;>> s =set(li)>>> s
2. Detailed introduction to Python’s built-in frozenset function
Introduction: This article explains in detail the detailed introduction of Python’s built-in frozenset function
3. Introduction to python core data types
## Introduction: Overview Numbers: int, long, float, complex, bool character: str, unicode list: list dictionary: dict tuple: tuple file: file other types: set (set), frozenset, class type, None other file type tools: pipes (pipes), first-in-first-out pipes (fifos) ,...
4. Python built-in function——set&frozenset
##Introduction: If you need the sample code of Python built-in function-set&frozenset, you can refer to it
[Related Q&A recommendations]:
The above is the detailed content of Summarize the points to note about frozenset. For more information, please follow other related articles on the PHP Chinese website!