Try our new documentation site (beta).
Filter Content By
Version
Text Search
${sidebar_list_label} - Back
Filter by Language
tupledict.select()
select ( pattern )
Returns a list
containing the values associated with keys that
match the specified tuple pattern. The pattern should provide one
value for each field in the key tuple. A '*'
value indicates
that any value is accepted in that field.
Without arguments, this method returns a list of all values in the
tupledict
.
Arguments:
pattern: Pattern to match for a key tuple.
Example usage:
d = tupledict([((1,2), 'onetwo'), ((1,3), 'onethree'), ((2,3), 'twothree')]) print(d.select()) # prints ['onetwo', 'onethree', 'twothree'] print(d.select(1, '*')) # prints ['onetwo', 'onethree'] print(d.select('*', 3)) # prints ['onethree', 'twothree'] print(d.select(1, 3)) # prints ['onethree']