tupledict.select ()
tupledict.select ()
选择(模式)返回一个列表
包含与匹配指定元组模式的键关联的值。模式应该为键元组中的每个字段提供一个值。一个‘*’
Value表示该字段接受任何值。
如果没有参数,此方法将返回一个列表,其中包含tupledict
.
参数:
模式:键元组要匹配的模式。
使用示例:
d = tupledict((((1、2),“onetwo”),((1,3),“onethree”),((2、3),“twothree”)])打印(d.select()) #打印(‘onetwo’,‘onethree’,‘twothree)打印(d。选择(1 , '*')) # 打印(‘onetwo’,‘onethree)打印(d。选择('*', 3)) # prints ['onethree', 'twothree'] print(d.select(1, 3)) # prints ['onethree']