list1 = ['a','b','c','d']
list2 = ['a','b','e']
list1_not_in_list2 = [i for i in list1 if i not in list2]
list2_not_in_lis1 = [i for i in list2 if i not in list1]
输出如下
list1_not_in_list2就是删除list1中list1和list2都存在的元素
list2_not_in_lis就是删除list2中list1和list2都存在的元素
参考了这个链接
https://www.cnblogs.com/songbiao/articles/12348465.html