unified-diff

How to print the comparison of two multiline strings in unified diff format?

核能气质少年 提交于 2019-12-05 10:00:21
问题 Do you know any library that will help doing that? I would write a function that prints the differences between two multiline strings in the unified diff format. Something like that: def print_differences(string1, string2): """ Prints the comparison of string1 to string2 as unified diff format. """ ??? An usage example is the following: string1=""" Usage: trash-empty [days] Purge trashed files. Options: --version show program's version number and exit -h, --help show this help message and

How to print the comparison of two multiline strings in unified diff format?

对着背影说爱祢 提交于 2019-12-04 00:03:24
Do you know any library that will help doing that? I would write a function that prints the differences between two multiline strings in the unified diff format. Something like that: def print_differences(string1, string2): """ Prints the comparison of string1 to string2 as unified diff format. """ ??? An usage example is the following: string1=""" Usage: trash-empty [days] Purge trashed files. Options: --version show program's version number and exit -h, --help show this help message and exit """ string2=""" Usage: trash-empty [days] Empty the trash can. Options: --version show program's