这是我的单词表。(实际上我正在使用一个大列表。)
banana
fish
scream
screaming
suncream
suncreams
我想扩大s'cream。它必须suncream仅匹配。
不匹配,scream因为没有撇号字符。
不匹配,suncreams因为末尾的 s 下落不明。
我对它的编程不是很好,因为它只匹配所有的单词。
我尝试过的。这很尴尬。我不知道我在做什么。
find = "s'cream"
with open('words') as f:
for line in f:
word = line.strip()
skipchars = False
for c in find:
if c == "'":
skipchars = True
continue
if skipchars:
for w in word:
if c != w:
continue
if c not in word:
break
skipchars = False
print(word)
慕无忌1623718
HUH函数
相关分类