Skip to content

Instantly share code, notes, and snippets.

@jaxon
Created September 19, 2012 02:28
Show Gist options
  • Save jaxon/3747302 to your computer and use it in GitHub Desktop.
Save jaxon/3747302 to your computer and use it in GitHub Desktop.
Errors in n lists, ignoring duplicates in individual lists
allServers = {}
finalList = []
serverErrors = []
serverErrors.append(['Error1','Error2','Error3','Error1'])
serverErrors.append(['Error3','Error2'])
serverErrors.append(['Error2','Error2','Error3','Error1','Error1','Error1','Error1'])
i = 0
for thisServerErrors in serverErrors:
i = i + 1
for thisServerError in thisServerErrors:
if not allServers.has_key(thisServerError):
allServers[thisServerError] = 0
if allServers[thisServerError] == i - 1:
allServers[thisServerError] = allServers[thisServerError] + 1
errorListLen = len(serverErrors)
for key in allServers.keys():
if allServers[key] == errorListLen:
finalList.append(key)
del(serverErrors)
del(allServers)
print finalList
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment