我的字典列表是“atm\U数据”,我当前的代码是:
def atms_location_type(atms_data):
atms_amount={'BranchExternal':0,'BranchInternal':0,'Other':0,'BranchLobby':0}
for i in atms_data:
if [i]['Location']['LocationCategory']=='BranchExternal':
atms_amount['BranchExternal']+=1
elif [i]['Location']['LocationCategory']=='BranchInternal':
atms_amount['BranchInternal']+=1
elif [i]['Location']['LocationCategory']=='BranchLobby':
atms_amount['BranchLobby']+=1
elif [i]['Location']['LocationCategory']=='Other':
atms_amount['Other']+=1
return (atms_amount)
atms_location_type(atms_data)
atms_amount_clear=atms_location_type(atms_data)
应该用
i
替换[i]
,这里有一个简短的代码相关问题 更多 >
编程相关推荐