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

  1. Python string/list/tuple/dictionary conversions
  2. Python local and global variables
  3. The Python type function is different from the isinstance function
  4. Python is differs from ==
  5. Python mutable and immutable data types
  6. Shallow and deep copies of Python
  7. Python recursive functions
  8. Python sys module
  9. The Python list
  10. The Python tuple tuple
  11. Python dictionary dict
  12. Python conditional derivations
  13. Python list derivations
  14. Python dictionary derivations
  15. Python function declarations and calls
  16. Python variable argument *argc/**kargcs

Python Frozenset collection

This article is published by the blog – Ape Say Programming Ape Say programming!