如何在python中将unicode转换为字典

2024-09-24 06:26:10 发布

您现在位置:Python中文网/ 问答频道 /正文

我知道以前有人问过这种问题,但我找不到解决问题的办法

我的函数将以这种格式返回unicode

{"set_id": "Rome", "group": "human", "attachments": null, , "object_type": "Prop", "attached": null, "tag_id": "prop", "Double Click": "reference", "files": "/makeup/Data/weapons/rifle", "source": "cupid", "attachment_label": null, "require_attachment": true, "rate": "high", "location": "/set2/ep1/Objects/weapons/machineguns/gun.txt", "attachment_type": null, "icon_path": "/resource/asset_manager/icons/rifle.bmp"}

在检查类型时,显示它是<type 'unicode'>

我试过用ast.literal_eval(myver)但是没有运气 还有哪些方法可以将其转换为python字典?


Tags: 函数idattachment格式typeunicodegroupnull