Here is a long way of doing it. Much room for optimizing.
def compare(arg1, arg2): list1 = [] list2 = [] lastlist = [] with open(arg1, 'r') as file: lines = file.readlines() for line in lines: if ':' not in line: list1.append(line.strip()) with open(arg2, 'r') as file2: lines = file2.readlines() for line in lines: if ':' not in line: list2.append(line.strip()) for line in list2: if line not in list1: lastlist.append(line) return lastlist print(compare('IP1.txt', 'IP2.txt'))
Output:['192.168.0.799', '192.168.0.900', '192.168.0.1000', '192.168.0.83']
I welcome all feedback.
The only dumb question, is one that doesn't get asked.
My Github
How to post code using bbtags
The only dumb question, is one that doesn't get asked.
My Github
How to post code using bbtags