directory
- Python Frozenset set syntax
- The Python Frozenset collection
- Guess you like it
Recommended path for learning Python: Python Learning Directory >> Python Basics
In the previous article we covered Python sets in detail, but this frozenset is similar to a set!
The difference with Python sets is thatFrozenset collectionYou can’t modify/add/delete, otherwise it works the same as a set, so it’s kind of similarList the list 和Tuples tupleThe difference between.
Python Frozenset set syntax
A = frozenSet (iterable)Copy the code
** where iterable is a sequence or iterable and returns the frozenset set **;
The Python Frozenset collection
#! Usr /bin/env python # -* -coding :utf-8 _*- "" www.codersrc.com @file :Python Frozenset. py @time :2021/04/04 11:00 @Motto: A thousand miles without a single step, a river without a small stream, the wonderful life of the program needs to be accumulated unrelentingly! A = frozenset(["q123","python","frozenset"]) print(a) AttributeError: 'Frozenset' object has no attribute 'add' # a.dd ("hello")" frozenset({'frozenset', 'python', 'q123'}) <class 'frozenset'> '''Copy the code
AttributeError: ‘Frozenset’ object has no attribute ‘add’!
Reason: FrozenSet cannot be modified/added/removed, other functions are the same as set!
Guess you like it
- Python string/list/tuple/dictionary conversions
- Python local and global variables
- The Python type function is different from the isinstance function
- Python is differs from ==
- Python mutable and immutable data types
- Shallow and deep copies of Python
- Python recursive functions
- Python sys module
- The Python list
- The Python tuple tuple
- Python dictionary dict
- Python conditional derivations
- Python list derivations
- Python dictionary derivations
- Python function declarations and calls
- Python variable argument *argc/**kargcs
Python Frozenset collection
This article is published by the blog – Ape Say Programming Ape Say programming!