Generating and applying diffs in python

前端 未结 6 1335
野性不改
野性不改 2020-12-25 11:35

Is there an \'out-of-the-box\' way in python to generate a list of differences between two texts, and then applying this diff to one file to obtain the other, later?

<
6条回答
  •  青春惊慌失措
    2020-12-25 12:09

    Did you have a look at diff-match-patch from google? Apparantly google Docs uses this set of algoritms. It includes not only a diff module, but also a patch module, so you can generate the newest file from older files and diffs.

    A python version is included.

    http://code.google.com/p/google-diff-match-patch/

提交回复
热议问题