This guide walks you through installing GroupDocs.Comparison for Python via .NET and comparing two documents end to end. By the end you will have a working environment, an output file showing the differences between two sample documents, and the code skeleton to extend for your own use cases.
Prerequisites
Python 3.5 or newer — verify with python --version.
On Linux and macOS, GroupDocs.Comparison also requires libgdiplus and font support — see the installation guide for the exact commands.
Step 1 — Install the package
Install GroupDocs.Comparison from PyPI:
pip install groupdocs-comparison-net
The wheel is roughly 150 MB and bundles the .NET runtime; no further setup is required on Windows.
Step 2 — Compare two documents
Save the following snippet as quick_start.py in the same folder as source.docx and target.docx, then run it with python quick_start.py.
fromgroupdocs.comparisonimportComparerdefquick_start():# Initialize Comparer with the source document and add the target.withComparer("./source.docx")ascomparer:comparer.add("./target.docx")# The result file contains the merged comparison highlighting added,# deleted, modified, and style changes.comparer.compare("./result.docx")if__name__=="__main__":quick_start()
source.docx is the source file used in this example. Click here to download it.
target.docx is the target file used in this example. Click here to download it.
Without a license, GroupDocs.Comparison processes only the first two pages of any document and stamps trial badges on the output. To unlock the full feature set, apply a license — either via the GROUPDOCS_LIC_PATH environment variable (zero-code) or by calling License().set_license(path). Request a free 30-day temporary license at purchase.groupdocs.com/temporary-license.
See Licensing and subscription for the full set of options, including metered licensing and stream-based license loading.
Next steps
Compare documents — the full API surface for two-document comparison.