我在python中编程,我想知道是否有一种简单的方法来迭代(和解析)文本差异的各个块,由diff
实用程序输出
伪python代码:
textdiff = diff('file1', 'file2') # Pretend this is a way of producing a diff
for chunk in textdiff:
print('These lines are deleted: ', chunk.deletions)
... # And do some other interesting stuff with the extracted contents of the chunk.