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}}
は、キー= 'プリントMAX(D、見ていましたラムダx:x [1]) ' – AlexZ
あなたは最大のlocal.tanningを作ったはずです...答えが見つからないので... –
"日焼け "が10で、それを捕らえなければならない場合は、辞書を平坦化する必要があるかもしれません。このようなものを試してみてください[http://stackoverflow.com/questions/6027558/flatten-nested-python-dictionaries-compressing-keys](http://stackoverflow.com/questions/6027558/flatten-nested-python-dictionaries- –