python Pycharm开发平台,列表listA包含listB,现在需要取出两个list中的不同值,diff_list=[“23”, “78”]
说明:
转换为set再相减的目的去除list中重复的元素;
# -*- coding: utf-8 -*-listA = ["23", "45", "78", "92"]
listB = ["45", "92"]if __name__ == '__main__':diff_list = list(set(listA) - set(listB))print(diff_list)