集合にはイミュータブルなオブジェクトのみ(文字列など)含むことが出来る仕様です。
辞書はイミュータブルではないのでエラーとなります。
The Python Language Reference
Set types
These represent unordered, finite sets of unique, immutable objects. As such, they cannot be indexed by any subscript. However, they can be iterated over, and the built-in function len() returns the number of items in a set. Common uses for sets are fast membership testing, removing duplicates from a sequence, and computing mathematical operations such as intersection, union, difference, and symmetric difference.
For set elements, the same immutability rules apply as for dictionary keys. Note that numeric types obey the normal rules for numeric comparison: if two numbers compare equal (e.g., 1 and 1.0), only one of them can be contained in a set.
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2019/12/29 06:12 編集
2019/12/29 10:09