我目前有一些如下所示的 JSON:
{
"Chile": {
"num_of_unique_ips": 1,
"num_of_unique_asns": 1,
"asns": {
"AS16629 CTC. CORP S.A. (TELEFONICA EMPRESAS)": 1
}
},
"China": {
"num_of_unique_ips": 1,
"num_of_unique_asns": 1,
"asns": {
"AS4808 China Unicom Beijing Province Network": 1
}
}, # this goes on and on for ever country
}
Run Code Online (Sandbox Code Playgroud)
我通过运行将其转换为字典:
import json
login_by_country = json.loads(open('login_by_country.json', 'r'))
Run Code Online (Sandbox Code Playgroud)
我将如何按照每个国家/地区的值对这本词典进行排序num_of_unique_ips?