每找一个名字,就通过索引把它从原表中删掉 a = input().split(' ') b = input().split(' ') for i in b: c = a.index(i) a.pop(c) print(a)