Decorating Python's builtin print() function

后端 未结 4 657
夕颜
夕颜 2021-01-18 05:36

As we know in Python 3 print() is a function, is it possible to create a decorated version of it wrapped under json.dumps(indent=4)

for ex.

4条回答
  •  花落未央
    2021-01-18 05:51

    Alternatively, take a look at pprint. https://docs.python.org/3/library/pprint.html

提交回复
热议问题