我有以下字典:
{'AK': {'AK0010100': {'agency_name': 'Anchorage Police Department',
'agency_type_name': 'City',
'county_name': 'ANCHORAGE',
'division_name': 'Pacific',
'latitude': 61.17425,
'longitude': -149.284329,
'nibrs': False,
'nibrs_start_date': None,
'ori': 'AK0010100',
'region_desc': 'Region IV',
'region_name': 'West',
'state_abbr': 'AK',
'state_name': 'Alaska'},
'AK0010200': {'agency_name': 'Fairbanks Police Department',
'agency_type_name': 'City',
'county_name': 'FAIRBANKS NORTH STAR',
'division_name': 'Pacific',
'latitude': 64.83945,
'longitude': -147.71942,
'nibrs': False,
'nibrs_start_date': None,
'ori': 'AK0010200',
'region_desc': 'Region IV',
'region_name': 'West',
'state_abbr': 'AK',
'state_name': 'Alaska'}}}
而我只需要辅助键(例如“ak0010100”)。我尝试了以下代码:
for keys, values in cities.items():
for values in keys:
print(keys[values])
但这似乎不起作用。我对python还比较陌生,所以如果有任何帮助,我将不胜感激。提前谢谢!
1条答案
按热度按时间kyxcudwk1#
要获取辅助密钥,请执行以下操作:
印刷品: