difflib.Differ

class difflib.Differ This is a class for comparing sequences of lines of text, and producing human-readable differences or deltas. Differ uses SequenceMatcher both to compare sequences of lines, and to compare sequences of characters within similar (near-matching) lines. Each line of a Differ delta begins with a two-letter code: Code Meaning '- ' line unique to sequence 1 '+ ' line unique to sequence 2 '  ' line common to both sequences '? ' line not present in either input sequence Lines

difflib.context_diff()

difflib.context_diff(a, b, fromfile='', tofile='', fromfiledate='', tofiledate='', n=3, lineterm='\n') Compare a and b (lists of strings); return a delta (a generator generating the delta lines) in context diff format. Context diffs are a compact way of showing just the lines that have changed plus a few lines of context. The changes are shown in a before/after style. The number of context lines is set by n which defaults to three. By default, the diff control lines (those with *** or ---) a

dict.values()

values() Return a new view of the dictionary’s values. See the documentation of view objects.

dict.update()

update([other]) Update the dictionary with the key/value pairs from other, overwriting existing keys. Return None. update() accepts either another dictionary object or an iterable of key/value pairs (as tuples or other iterables of length two). If keyword arguments are specified, the dictionary is then updated with those key/value pairs: d.update(red=1, blue=2).

dict.setdefault()

setdefault(key[, default]) If key is in the dictionary, return its value. If not, insert key with a value of default and return default. default defaults to None.

dict.popitem()

popitem() Remove and return an arbitrary (key, value) pair from the dictionary. popitem() is useful to destructively iterate over a dictionary, as often used in set algorithms. If the dictionary is empty, calling popitem() raises a KeyError.

dict.pop()

pop(key[, default]) If key is in the dictionary, remove it and return its value, else return default. If default is not given and key is not in the dictionary, a KeyError is raised.

dict.keys()

keys() Return a new view of the dictionary’s keys. See the documentation of view objects.

dict.items()

items() Return a new view of the dictionary’s items ((key, value) pairs). See the documentation of view objects.

dict.get()

get(key[, default]) Return the value for key if key is in the dictionary, else default. If default is not given, it defaults to None, so that this method never raises a KeyError.