题解 | #删除好友#
删除好友
https://www.nowcoder.com/practice/656f7d09fe9c4d78919e7cc2b4a19c81
import sys str1 = input().split(' ') #将输入的字符串按照空格分隔成列表 str2 = input().split(' ') #将输入的字符串按照空格分隔成列表,不一定是一个 for i in str1: #遍历第一个列表 for j in str2: #遍历第二个列表,确定该列表所含有的名字是否在第一个列表中 if j==i: #如果在的话,就将其删除,使用remove(要删除的内容)方法 str1.remove(j) print(str1) #输出