Created
March 16, 2015 00:17
-
-
Save hosaka/0f9efb6413afec636fbd to your computer and use it in GitHub Desktop.
remove duplicates from two arrays with matching index
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
__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