February 2006
Intermediate to advanced
648 pages
14h 53m
English
The difflib module provides functions and classes for computing differences between lists of strings. The module duplicates the functionality provided by many variants of the popular Unix diff command that’s used to compare files.
context_diff(a, b [, fromfile [, tofile [, fromfiledate [, tofiledate [, n [, lineterm]]]]]])
Given two lists of strings, a and b, this function returns a generator object that produces output corresponding to a context-sensitive difference. The output produced by this function is similar to the following:
*** fromfile fromfiledate --- tofile tofiledate *************** *** 1,9 **** context context context ! modified line context - deleted line context context context --- 1,9 ---- context context context ! ...
Read now
Unlock full access