# 去掉arr2中 arr2与arr1重复的元素 arr1 = ['a','b','c'] arr2 = ['a','e','f'] for item in arr2: if item in arr1: arr2.remove(item) print(arr2)# 结果:['e','f']
# 去掉arr2中 arr2与arr1重复的元素 arr1 = ['a','b','c'] arr2 = ['a','e','f'] for item in arr2: if item in arr1: arr2.remove(item) print(arr2)# 结果:['e','f']