Skip to content

Instantly share code, notes, and snippets.

@ayota
Last active August 29, 2015 13:58
Show Gist options
  • Save ayota/10009847 to your computer and use it in GitHub Desktop.
Save ayota/10009847 to your computer and use it in GitHub Desktop.
def deduplicate(file1, file2):
with open(file1,"r") as file_1:
event_1 = file_1.read().split("\n")
with open(file2,"r") as file_2:
event_2 = file_2.read().split("\n")
master_list = list(set(event_1 + event_2))
doubles = []
for name in master_list:
if name in event_1 and name in event_2:
doubles.append(name)
return master_list, doubles
master_list, doubles = deduplicate('film_screening_attendees.txt','happy_hour_attendees.txt')
print "MASTER LIST OF ATTENDEES \n"
for index, name in enumerate(master_list):
print "{0}. {1} \n".format(index+1, name)
print "ATTENDEES AT BOTH EVENTS \n"
for index, name in enumerate(doubles):
print "{0}. {1} \n".format(index+1, name)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment