json.JSONDecodeError.lineno

lineno The line corresponding to pos.

json.JSONDecodeError.doc

doc The JSON document being parsed.

json.JSONDecodeError.colno

colno The column corresponding to pos.

json.JSONDecodeError

exception json.JSONDecodeError(msg, doc, pos, end=None) Subclass of ValueError with the following additional attributes: msg The unformatted error message. doc The JSON document being parsed. pos The start index of doc where parsing failed. lineno The line corresponding to pos. colno The column corresponding to pos. New in version 3.5.

json.dumps()

json.dumps(obj, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, cls=None, indent=None, separators=None, default=None, sort_keys=False, **kw) Serialize obj to a JSON formatted str using this conversion table. The arguments have the same meaning as in dump(). Note Unlike pickle and marshal, JSON is not a framed protocol, so trying to serialize multiple objects with repeated calls to dump() using the same fp will result in an invalid JSON file. Note Keys in key/value

json.dump()

json.dump(obj, fp, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, cls=None, indent=None, separators=None, default=None, sort_keys=False, **kw) Serialize obj as a JSON formatted stream to fp (a .write()-supporting file-like object) using this conversion table. If skipkeys is true (default: False), then dict keys that are not of a basic type (str, int, float, bool, None) will be skipped instead of raising a TypeError. The json module always produces str objects, not by

itertools.zip_longest()

itertools.zip_longest(*iterables, fillvalue=None) Make an iterator that aggregates elements from each of the iterables. If the iterables are of uneven length, missing values are filled-in with fillvalue. Iteration continues until the longest iterable is exhausted. Roughly equivalent to: class ZipExhausted(Exception): pass def zip_longest(*args, **kwds): # zip_longest('ABCD', 'xy', fillvalue='-') --> Ax By C- D- fillvalue = kwds.get('fillvalue') counter = len(args) - 1

itertools.tee()

itertools.tee(iterable, n=2) Return n independent iterators from a single iterable. Roughly equivalent to: def tee(iterable, n=2): it = iter(iterable) deques = [collections.deque() for i in range(n)] def gen(mydeque): while True: if not mydeque: # when the local deque is empty try: newval = next(it) # fetch a new value and except StopIteration: return for d in

itertools.takewhile()

itertools.takewhile(predicate, iterable) Make an iterator that returns elements from the iterable as long as the predicate is true. Roughly equivalent to: def takewhile(predicate, iterable): # takewhile(lambda x: x<5, [1,4,6,4,1]) --> 1 4 for x in iterable: if predicate(x): yield x else: break

itertools.starmap()

itertools.starmap(function, iterable) Make an iterator that computes the function using arguments obtained from the iterable. Used instead of map() when argument parameters are already grouped in tuples from a single iterable (the data has been “pre-zipped”). The difference between map() and starmap() parallels the distinction between function(a,b) and function(*c). Roughly equivalent to: def starmap(function, iterable): # starmap(pow, [(2,5), (3,2), (10,3)]) --> 32 9 1000 for arg