There was an error while loading. Please reload this page.
1 parent 2604e33 commit dbb677aCopy full SHA for dbb677a
1 file changed
Doc/library/difflib.rst
@@ -483,13 +483,15 @@ The :class:`SequenceMatcher` class has this constructor:
483
>>> b = "abycdf"
484
>>> s = SequenceMatcher(None, a, b)
485
>>> for tag, i1, i2, j1, j2 in s.get_opcodes():
486
- ... print(("%7s a[%d:%d] (%s) b[%d:%d] (%s)" %
487
- ... (tag, i1, i2, a[i1:i2], j1, j2, b[j1:j2])))
488
- delete a[0:1] (q) b[0:0] ()
489
- equal a[1:3] (ab) b[0:2] (ab)
490
- replace a[3:4] (x) b[2:3] (y)
491
- equal a[4:6] (cd) b[3:5] (cd)
492
- insert a[6:6] () b[5:6] (f)
+ print('{:7} a[{}:{}] --> b[{}:{}] {!r:>8} --> {!r}'.format(
+ tag, i1, i2, j1, j2, a[i1:i2], b[j1:j2]))
+
+ delete a[0:1] --> b[0:0] 'q' --> ''
+ equal a[1:3] --> b[0:2] 'ab' --> 'ab'
+ replace a[3:4] --> b[2:3] 'x' --> 'y'
493
+ equal a[4:6] --> b[3:5] 'cd' --> 'cd'
494
+ insert a[6:6] --> b[5:6] '' --> 'f'
495
496
497
.. method:: get_grouped_opcodes(n=3)
0 commit comments