On this page
  1. difflib.restore
  2. Import
  3. Signature & Overview
  4. Usage
  5. Gotchas
  6. REPL Inspect

difflib.restore

Prev: difflib.ndiff | Up: difflib | Next: difflib.SequenceMatcher
Rel: difflib.context_diff, difflib.diff_bytes, difflib.Differ, difflib.get_close_matches
Ref: docs.python.org — difflib.restore
Tags: #public #python3 #stdlib #difflib


Import

import difflib
from difflib import restore

Signature & Overview

difflib.restore(delta, which)

Generate one of the two sequences that generated a delta.

Usage

import difflib

diff = list(difflib.ndiff(["a\n", "b\n"], ["a\n", "c\n"]))
assert list(difflib.restore(diff, 1)) == ["a\n", "b\n"]
assert list(difflib.restore(diff, 2)) == ["a\n", "c\n"]

Gotchas

REPL Inspect

from difflib import restore
help(restore)

Linked from

Related notes