all Python 3Sets (set)function
frozenset.issubset
frozenset
True if every element of the frozenset is in the other set (subset).
Syntax
f.issubset(other)
The method accepts any iterable, while the <= operator insists on a real set: f <= [1, 2, 3] raises TypeError, but f.issubset([1, 2, 3]) works. A set is a subset of itself, so equal sets give True; for a strict subset use <. Strings are consumed character by character, so frozenset('cat').issubset('character') is about letters, not substrings.
Examples
print(frozenset({1, 2}).issubset({1, 2, 3})) # → True
print(frozenset({1, 4}).issubset({1, 2, 3})) # → False
print(frozenset({1, 2}).issubset([1, 2, 3])) # → True
print(frozenset('cat').issubset('character')) # → True
print(frozenset({1, 2}).issubset({1, 2})) # → True
print(frozenset({1, 2}) < {1, 2}) # → False
See also
Open in the full glossarydocs.python.orgReport an inaccuracy