我有这个需要转换为小写的Python字典.字典由需要对不区分大小写输入的数据组成,例如,它适用于resp ='GBR'或'gbr'.希望我在这里有意义.任何帮助将非常感谢!
resp = raw_input('Which country is ' + record['name'] + ' in? ')
print " "
valid = {'GBR': ['GBR',
'United Kingdom',
'UK',
'Great Britain and Northern Island',
'GB'
],
'IRL': ['IRL',
'Eire',
'Republic of Ireland'
]
}
if resp in valid[record['sov']]:
answ = 'Yes, ' + record['name'] + ' is in the ' + resp
Run Code Online (Sandbox Code Playgroud)