I can create a unified diff as follows: udiff = difflib.unified_diff(text1, text2) Is there an available function somewhere to apply udiff to text1 and construct text2, like this? text2 = some_func(text1, udiff) Thanks for any clues.