我想返回一个单词列表,其中包含一个不考虑大小写的字母。说如果我有sentence = "Anyone who has never made a mistake has never tried anything new",那么f(sentence, a)会回来
['Anyone', 'has', 'made', 'a', 'mistake', 'has', 'anything']
这就是我所拥有的
import re
def f(string, match):
string_list = string.split()
match_list = []
for word in string_list:
if match in word:
match_list.append(word)
return match_list
蓝山帝景
白衣染霜花
慕哥6287543
相关分类