これが私の単語リストです。(実際には大きなリストを使用しています。)
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)