The HtmlDiff class in Python

When the differences between texts to be presented in HTML format - either in full form or contextual form the Python class HtmlDiff from the Python Standard Library can be used.

Htmldiff Updated 9 Mar 2026 1 min read

Overview

The HtmlDiff class of the Python difflib module provides methods to list differences in texts in a HTML table. The format of the differences provided are in either full or contextual format.