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']