如何在每个打印结果旁边添加其他文本?

时间:2019-12-01 08:38:39

标签: python-3.x text printing

这是我的代码:

from functools import partial

def x_in_y(word, inner):
    return inner in word

wrong = ['mann','connaction','tee','rigt','putt']
sentence=['this mann is my son','the connaction is unstable','my tee is getting cold','put your hands down','rigt now','right behind my back']

for i in wrong:
    print(f"Wrong: {i}")
    filtered_names = filter(partial(x_in_y, inner=i), sentence)
    for name in filtered_names:
        print(name)

如何在每个标签旁边添加一个正确的单词?则表示每个结果的正确单词。

喜欢这个:

Wrong: mann "should be man"
this mann is my son
Wrong: connaction "should be connection"
the connaction is unstable
Wrong: tee "should be tea"
my tee is getting cold
Wrong: rigt "should be right"
rigt now

0 个答案:

没有答案