我需要我的代码接受2个输入,一个字符串和第二个字符串。换句话说,第一个字符串是某种类型的句子,第二个字符串只是从整个句子中删除的几个字母。例如:
remove("This is as it is.", "is") == 'Th as it .'
到目前为止,我已经:
def remove(word, reword):
s = set(reword)
return (x for x in word if x not in s)
remove("This is as it is.", "is")
print(word)
Tags:
您可以为此使用替换功能
相关问题 更多 >
编程相关推荐