Skip to content

Tag: difflib

Why do I get a stray element with difflib.ndiff?

Minimal working example: Can someone please explain why there’s a newline character as the fourth element in the output list? What can I do to not get that element as ndiff output, but only the rest of the list? Answer Because ndiff expects the lines you pass in to end with newline characters, like this…