I have written the following code to get all of the IP-Addresses out of a file and print them:
with open("C:\\users\\joey\\desktop\\access.log",'r') as bestand:
for line in bestand:
try:
splittedline = line.split('sftp-session')[1].split("[")[1].split("]")[0]
except Exception:
continue
print splittedline
The following code prints all of the IP-Addresses of another file:
with open("C:\\users\\joey\\desktop\\exit_nodes.csv",'r') as bestand:
for line in bestand:
print line
How can I compare the 2 files and only show unique IP-Addresses and remove the duplicates?
The output atm is like:
217.172.190.19
217.210.165.43
218.250.241.229
223.18.115.229
223.133.243.101