Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
看来只能frozenset使用frozenset()构造函数创建一个。
frozenset
frozenset()
这是真的还是有一种文字方式来创建一个冻结集?我在文档中找不到任何证据
上面你链接的一句话是答案(强调我的):
可以通过在大括号内放置以逗号分隔的元素列表来创建非空集(非 freezesets{'jack', 'sjoerd'} ),例如:除了set构造函数之外。
{'jack', 'sjoerd'}
set
所以简而言之,不,没有办法做到这一点