我有一个统一的diff文件(我们称之为补丁)。我需要打开它,应用于指定的文件并将结果保存回文件。与Unix的
我查看了https://code.google.com/p/google-diff-match-patch/wiki/API,看起来它不能做我需要的事情。我还看了https://github.com/techtonik/python-patch和https://github.com/matiasb/python-unidiff。
patch
工具相同。我需要一个Python解决方案,我可以轻松地从我的.py脚本中调用,但到目前为止我找不到任何方法。我查看了https://code.google.com/p/google-diff-match-patch/wiki/API,看起来它不能做我需要的事情。我还看了https://github.com/techtonik/python-patch和https://github.com/matiasb/python-unidiff。
python-patch
似乎模拟了Unix的patch
实用程序,但它是一个命令行工具,我不知道如何从我的.py脚本中调用它。