Hello,
Bare with me, as I am new to Python and a beginner programmer.
I am trying to compare two lists (not of the same length), and create a new
list of items that are -not- found in both lists.
Scenario: I have a list of MAC addresses that are known and good, and am
comparing it to a list of MACs found in a scan. I want to weed out the
those which are unknown. I am using IDLE (Python 2.7) on Windows, and all
files are in the same directory.
Code:
scanResults = open('scanResults.txt', 'r')
verifiedList = open('verifiedList.txt', 'r')
badMacs = []
for mac in scanResults:
if mac not in verifiedList:
print mac
badMacs.append(mac)
else:
break
When I print 'badMacs', the results come up empty:
[]
Any help would be greatly appreciated!
Regards,
Justin
_______________________________________________
Tutor maillist - [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor