TextDifferently

class differently.TextDifferently(a: str, b: str, color: bool = True)

Visualises the differences between two bodies of text.

Use the string representation or inherited ListDifferently.render() to render.

Parameters
  • a – First body

  • b – Second body

  • color – Include or exclude colour formatting (default is True)

Example

from differently import TextDifferently

diff = TextDifferently(
    "It was the best of times,\nIt was the burst of times.",
    "It was the best of times,\nIt was the worst of times.",
    color=False,
)

print(diff)
It was the best of times,   =  It was the best of times,
It was the burst of times.  ~  It was the worst of times.
static load(path: pathlib.Path) str

Gets the body of the text file at path.

Parameters

path – Path to text file

Returns

Body