Finding differences between strings

前端 未结 3 866
礼貌的吻别
礼貌的吻别 2021-02-03 14:36

I have the following function that gets a source and a modified strings, and bolds the changed words in it.

def appendBoldChanges(s1, s2):
    \"Adds &l         


        
3条回答
  •  星月不相逢
    2021-02-03 15:12

    Have a look at the difflib module, you could use a SequenceMatcher to find the changed regions in your text.

提交回复
热议问题