import dns.resolver results = dns.resolver.query('wordpress.com', 'A') stringResults = [] for ip in results: print(ip.to_text()) stringResults.append(ip.to_text()) dummyList = ['192.0.78.9', '192.0.78.17', '2.3.4.5'] def diff(li1, li2): return (list(list(set(li1)-set(li2)) + list(set(li2)-set(li1)))) print('Diff results: ', diff(stringResults,dummyList))