Created
April 12, 2012 20:01
-
-
Save hampelm/2370600 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
results = [(p1.address, p1.program), (p2.address, p2.program)] | |
grouped_results = {} | |
for elt in results: | |
if elt.address in grouped_results: | |
grouped_results[elt.address].append(elt.program) | |
else: | |
grouped_results[elt.address] = [elt.program] | |
# To print out the groupings: | |
for address, programs in grouped_results.iteritems(): | |
print address | |
print program for program in programs |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment