[英]How to add multiple value to a dictionary key in Python
我是python的新手。
list = {('9034','1234'):'BMW', '9996':'Chevy', '7206':'Ford'}
x = raw_input("Enter first 4 digit: ")
print (list[(x)])
如何打印值“ 9034”和“ 1234”的宝马
只需为其输入两个单独的条目。
list = {'9034': 'BMW', '1234': 'BMW', '9996': 'Chevy', '7206': 'Ford'}
x = raw_input("Enter first 4 digit: ")
print(list[x])
另外,请考虑将列表重命名为其他名称,因为list
是Python中的对象类型和内置名称。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.