So what I'm looking for here is something like PHP's print_r function.
(所以我在这里寻找的是类似PHP的print_r函数。)
(这样一来,我可以通过查看问题对象的状态来调试脚本。)
You want vars() mixed with pprint() :
vars()
pprint()
(您想要vars()与pprint()混合:)
from pprint import pprint pprint(vars(your_object))
2.1m questions
2.1m answers
60 comments
57.0k users