from diff_match_patch import diff_match_patch dmp = diff_match_patch() patches = dmp.patch_make(text1,text2) diff = dmp.patch_toText(patches)