- 已关闭。**此问题需要debugging details。当前不接受答案。
编辑问题以包含desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem。这将有助于其他人回答问题。
44分钟前关门了。
Improve this question
我的Json文件有以下内容
{
"role": [
{
"type": "account",
"attributes": {
"order": 50
}
},
{
"type": "secretary",
"attributes": {
"order": 10
}
},
{
"type": "account",
"attributes": {
"order": 3
}
}
]
}
我想得到所有角色之间的最大顺序的角色。我怎么能在python中做到这一点呢?
我已尝试以下方法:
lowestpriority = roles.attributes[max('order')]
但它给出了一个错误:属性错误:'list'对象没有属性'attributes'
1条答案
按热度按时间kqlmhetl1#
你是JS出身?
事实上列表没有这样的属性。假设角色是你的列表(因为你没有提供任何代码):