Created
September 19, 2012 02:28
-
-
Save jaxon/3747302 to your computer and use it in GitHub Desktop.
Errors in n lists, ignoring duplicates in individual lists
This file contains 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
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