How to programmatically merge text files with potential conflicts (ala git or svn, etc)?

后端 未结 2 1688
青春惊慌失措
青春惊慌失措 2021-02-07 22:06

As part of a larger project, I want the ability to take two bodies of text and hand them to a merge algorithm which returns either an auto-merged result (in cases where the chan

相关标签:
2条回答
  • 2021-02-07 22:55

    Did you check out difflib

    • http://docs.python.org/library/difflib.html
    0 讨论(0)
  • 2021-02-07 23:03

    You're probably searching for merge algorithms like 3-way merging, which you can find in many open source projects, e.g. in the bazaar VCS (merge3.py source).

    0 讨论(0)
提交回复
热议问题