Skip to content

Instantly share code, notes, and snippets.

@mrchrisadams
Created September 4, 2018 11:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrchrisadams/91d2839b0104267e52aff197de1d2f73 to your computer and use it in GitHub Desktop.
Save mrchrisadams/91d2839b0104267e52aff197de1d2f73 to your computer and use it in GitHub Desktop.
How do I pass keywords in to this query() function in python?
set_o_tuples = [
("streetaddress", "burdon")
("area", "bungo"),
("region", "bingo"),
("some_other_key", "bango"),
])
for key, val in set_o_tuples:
# I want to run code like this, but keept it DRYer than
# literally typing the the code below
# some_obj.query(streetaddress="burdon")
# some_obj.query(area="bungo")
# some_obj.query(region="bingo")
# some_obj.query(some_other_key="bango")
some_obj.query(key=val)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment