Set: A set of different elements that form a collection, which is the basic data type of Python. Collection classification: Variable set (set), immutable set (Frozenset), created in the same set of features: unordered, unique, fast 1. Create collection >>> 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. Access the collection because the collection itself is unordered, it cannot be a collection
1. Python Basic content: Collections
Summary: Set: Sets different elements together to form a set, which is the basic data type of Python. Collection classification: Variable set (set), immutable set (Frozenset), created in the same set of features: unordered, unique, fast 1. Create collection >>> 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 functions
Introduction: This article explains in detail the Python built-in frozenset function
3. Python Core Data type introduction
Introduction: Overview Numbers: Int,long,float,complex,bool characters: Str,unicode list: Lists dictionary: dict tuples: Tuple files: File Other types: Collection (set), Frozenset, class type, None other file class tools: Pipe (Pipes), FIFO (FIFOs), ...
4. Python built-in function--set&frozenset
Summary: Python built-in function--set&frozenset sample code There is a need to refer to the following
"Related question and answer recommendation":