我正在尝试使用 http://jinja.pocoo.org/docs/dev/templates/#pprint pprint
像这样的功能:{{ pprint(player) }}
在我的 html 文件中,但出现以下错误:
jinja2.exceptions.UndefinedError
UndefinedError: 'pprint' is undefined
Jinja2 是 Python 的模板引擎。
任何人都可以帮助我显示变量以便于调试吗?
最佳答案
你必须这样使用它:
{{ flash_messages|pprint }}
或者在你的情况下:
{{ player|pprint}}
关于python-2.7 - pprint jinja2 调试变量助手,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25728708/