Using 'diff' (or anything else) to get character-level diff between text files

前端 未结 15 2249
借酒劲吻你
借酒劲吻你 2020-12-02 05:40

I\'d like to use \'diff\' to get a both line difference between and character difference. For example, consider:

File 1

abcde
ab         


        
15条回答
  •  再見小時候
    2020-12-02 06:26

    Python's difflib can do this.

    The documentation includes an example command-line program for you.

    The exact format is not as you specified, but it would be straightforward to either parse the ndiff-style output or to modify the example program to generate your notation.

提交回复
热议问题