def remove_items_in_a_from_b(left, right): left_lines = open(left, 'r').readlines() right_lines = open(right, 'r').readlines() return [line for line in right_lines if line not in left_lines] if __name__ == '__main__': import os import sys left = os.path.expanduser(sys.argv[1]) right = os.path.expanduser(sys.argv[2]) print(f' LEFT: {left}') print(f'RIGHT: {right}') unique_in_b = remove_items_in_a_from_b(left, right) print("___________") print(''.join(unique_in_b))