Skip to content

Instantly share code, notes, and snippets.

@hosaka
Created March 16, 2015 00:17
Show Gist options
  • Save hosaka/0f9efb6413afec636fbd to your computer and use it in GitHub Desktop.
Save hosaka/0f9efb6413afec636fbd to your computer and use it in GitHub Desktop.
remove duplicates from two arrays with matching index
__author__ = 'march'
ips = ["192.312.3", "192.312.3", "192.312.3", "10.10.3.4", "99.23.1.3", "99.23.1.3"]
ts = ["1", "2", "3", "4", "5", "6"]
new_ips = []
new_ts = []
for ip in ips:
new_ips.append(ip)
new_ts.append(ts[ips.index(ip)])
while ips.count(ip) > 1:
ips.remove(ip)
del ts[ips.index(ip)]
ips = new_ips
ts = new_ts
print(ips)
print(ts)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment