Skip to content

Instantly share code, notes, and snippets.

@twr14152
Created February 15, 2020 21:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save twr14152/93701de4b44041a16d42fffeca74f87f to your computer and use it in GitHub Desktop.
Save twr14152/93701de4b44041a16d42fffeca74f87f to your computer and use it in GitHub Desktop.
Finding duplicate IPs in a souce list
#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