PyDocs

Nav

Text Processing Services

Differ.__init__

difflib

method of Differ (source)
  • Differ.__init__(linejunk=None, charjunk=None)
Construct a text differencer, with optional filters.

The two optional keyword parameters are for filter functions:

- `linejunk`: A function that should accept a single string argument,
  and return true iff the string is junk. The module-level function
  `IS_LINE_JUNK` may be used to filter out lines without visible
  characters, except for at most one splat ('#').  It is recommended
  to leave linejunk None; the underlying SequenceMatcher class has
  an adaptive notion of "noise" lines that's better than any static
  definition the author has ever been able to craft.

- `charjunk`: A function that should accept a string of length 1. The
  module-level function `IS_CHARACTER_JUNK` may be used to filter out
  whitespace characters (a blank or tab; **note**: bad idea to include
  newline in this!).  Use of IS_CHARACTER_JUNK is recommended.
0 Examples
No examples for difflib/Differ.__init__.
See Also
No see-alsos for difflib/Differ.__init__
0 Notes
No notes for Differ.__init__