pp#

pp(obj, jsonify=False, doprint=None, output=False, sort_dicts=False, **kwargs)[source]#

Shortcut for pretty-printing the object.

Almost identical to pprint.pprint(), but can also be used as an alias for pprint.pformat().

Parameters:
  • obj (any) – object to print

  • jsonify (bool) – whether to first convert the object to JSON, to handle things like ordered dicts nicely

  • doprint (bool) – whether to show output (default true)

  • output (bool) – whether to return output as a string (default false)

  • sort_dicts (bool) – whether to sort dictionary keys (default false, unlike pprint.pprint())

  • kwargs (dict) – passed to pprint.pprint()

Example:

d = {'my very': {'large': 'and', 'unwieldy': {'nested': 'dictionary', 'cannot': 'be', 'easily': 'printed'}}}
sc.pp(d)

New in version 1.3.1: output argument New in version 3.0.0: “jsonify” defaults to False; sort_dicts defaults to False; removed “verbose” argument