diff = difflib.unified_diff(lines1, lines2, fromfile='file1', tofile=
    'file2', lineterm='', n=0)
lines = list(diff)[2:]
added = [line[1:] for line in lines if line[0] == '+']
removed = [line[1:] for line in lines if line[0] == '-']
print('additions:')
for line in added:
    print(line)
print() 
print('additions, ignoring position')
for line in added:
    if line not in removed:
        pass
Compare two files report difference in python