Comparing the following examples of using difflib.ndiff()
from difflib import unified_diff, ndiff
print("".join(ndiff(
["aba\n"],
["abbba\n"]
)))
print("".join(ndiff(
["aba\n"],
["abbbba\n"]
)))
Output:
- aba
+ abbba
? ++
- aba
+ abbbba
The first points out where characters have to be added while the second one basically gave up and replaced the whole line.
How can I make the second one print out
the equivalent of
"You need to insert 3 'b's [here]."?
Expected output for the second print:
- aba
+ abbbba
? +++