tupledict.select ()

选择(模式)

返回一个列表包含与键相关联的值匹配指定的元组模式。模式应该为每个字段提供一个值的元组的关键。一个‘*’值表示接受的任何值。

不带参数,该方法返回一个列表的所有值tupledict

参数:

模式元组:模式匹配的关键。

使用示例:

d = tupledict ((((1、2),“onetwo”), ((1,3),“onethree”), ((2、3),“twothree”)])打印(d.select()) #打印(‘onetwo’,‘onethree’,‘twothree)打印(d。选择(“*”))#打印(‘onetwo’,‘onethree)打印(d。选择('*', 3)) # prints ['onethree', 'twothree'] print(d.select(1, 3)) # prints ['onethree']