Skip to content

Instantly share code, notes, and snippets.

@michaelrice
Last active August 29, 2015 14:06
Show Gist options
  • Select an option

  • Save michaelrice/666561fc9286bbfda8af to your computer and use it in GitHub Desktop.

Select an option

Save michaelrice/666561fc9286bbfda8af to your computer and use it in GitHub Desktop.
# list_one always has fewer list items than list 2
# both lists have several thousand items in them
list_one = [
{"acct": "12345a","moref":"dc-12"},
{"acct":"132132","moref":"dc-332"}
]
list_two = [
{"acct":"132132","cc":"US","zip":"77722"},
{"acct": "12345a", "zip":"55512","cc":"US"},
{"acct":"11132132","cc":"US","zip":"77722"}
]
# Looking for most efficient way to combine list_one[0] with list_two[1]
# where the acct matches so I end up with a dict like {"acct": "12345a","moref":"dc-12", "zip":"55512","cc":"US"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment