Created
February 15, 2020 21:12
-
-
Save twr14152/93701de4b44041a16d42fffeca74f87f to your computer and use it in GitHub Desktop.
Finding duplicate IPs in a souce list
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
#sample Source List | |
ip_address = ["10.0.0.1", "10.0.0.1", "10.0.0.2", "12.0.3.1", "10.9.0.1", "12.0.1.1", "10.0.0.2"] | |
ip_counts = {ip: ip_address.count(ip) for ip in set(ip_address)} | |
for ip, count in ip_counts.items(): | |
if count > 1: | |
print(f"Dup IP:{ip} number of dup hosts {count}") | |
else: | |
continue | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment