如果第一个字符串中的字母也包含在第二个字符串中,我希望能够返回True
。例如,only_uses_letters_from("boffo","foobar")
应返回True
。以下是我迄今为止:在python中区分字符串
def only_uses_letters_from(x, y):
"""returns true if the first string only contains characters that are also in the second string
str, str -> str"""
for letter in x:
if x in y:
return True
else:
return False
应该是'海峡,海峡 - > bool' BTW ... – 2015-02-09 01:11:01