d = {
"local": {
"count": 1,
"health-beauty": {
"count": 1,
"tanning": {"count": 1}
}
},
"nationwide": {"count": 9.0},
"travel": {"count": 0}
}
在这个例子中,"nationwide"
是最大的。下面是代码,方便附加到脚本中:
d = {'travel': {'count': 0}, 'local': {'count': 1, 'health-beauty': {'count': 1, 'tanning': {'count': 1}}}, 'nationwide': {'count': 9.0}}
print max(d, key=lambda x: x[1])
- AlexZ