对于拼写检查器,我想在拼写中添加两个缺少的字母。 请告诉我怎么用python做。 我有加一个字母的密码。你知道吗
def splits(word):
result = []
for i in range(len(word) + 1):
result.append((word[:i], word[i:]))
print result
return result
def inserts(word):
result = []
for a, b in splits(word):
for c in alphabet:
result.append(a + c + b)
return result
例如,我有单词He
我想要结果Haeb
,aHeb
,abHe
等等
试试这个:
结果:
相关问题 更多 >
编程相关推荐