Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/307.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 将元组传递给冻结集_Python - Fatal编程技术网

Python 将元组传递给冻结集

Python 将元组传递给冻结集,python,Python,我有这个元组 t = ( { "path": "/api/", "uuid": "068aebae", "params": { "name": "foobar", }, "response": {"is_true&qu

我有这个
元组

t = (
    {
        "path": "/api/",
        "uuid": "068aebae",
        "params": {
            "name": "foobar",
        },
        "response": {"is_true": False},
        "content": "bar",
    },
)
我想传给一个
frozenset

>>> frozenset(d)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: unhashable type: 'dict'
>frozenset(d)
回溯(最近一次呼叫最后一次):
文件“”,第1行,在
TypeError:无法损坏的类型:“dict”

我该怎么做?

您的元组包含一个字典。字典是,这意味着包含它们的元组也是。如果要将字典(以及内部字典)用作集合元素的一部分,则需要将其更改为元组或其他可散列的内容。你可能会对它感兴趣。