On this page
  1. difflib.HtmlDiff
  2. Import
  3. Signature & Overview
  4. Methods & Attributes
  5. Usage
  6. Gotchas
  7. REPL Inspect

difflib.HtmlDiff

Prev: difflib.get_close_matches | Up: difflib | Next: difflib.Match
Rel: difflib.context_diff, difflib.diff_bytes, difflib.Differ, difflib.get_close_matches
Ref: docs.python.org โ€” difflib.HtmlDiff
Tags: #public #python3 #stdlib #difflib


Import

import difflib
from difflib import HtmlDiff

Signature & Overview

difflib.HtmlDiff(tabsize=8, wrapcolumn=None, linejunk=None, charjunk=<function IS_CHARACTER_JUNK at 0x109cd6140>)

For producing HTML side by side comparison with change highlights.

Methods & Attributes

Usage

import difflib

html = difflib.HtmlDiff().make_table(["old line"], ["new line"])
assert "<table" in html and "old line" in html and "new line" in html

Gotchas

REPL Inspect

from difflib import HtmlDiff
help(HtmlDiff)

Linked from

Related notes