首先,我试图从字符串中替换几个e,最后字符串如下所示-
string = 'Python is e high-level progremming lenguege'如何用拼写错误代替“e”,而其他“e”则保持不变?
发布于 2022-09-24 10:42:28
你可以用textblob。
from textblob import TextBlob
text = "Python is e high-level progremming lenguege" # incorrect spelling
correct_text = TextBlob(text).correct()
print(correct_text)
>>> Python is e high-level programming language注意:“e”不改为“a”,因为它只纠正拼写,而不是字母或语法。
https://stackoverflow.com/questions/73836468
复制相似问题