源氏-如何打印范围内的所有变量 [英] Genshi - how to print out all variables in scope
本文介绍了源氏-如何打印范围内的所有变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
很简单,我想打印出genshi模板中范围内的所有变量,以作为调试和发现措施.有办法吗?
Quite simply I'd like to print out all variables that are in scope in my genshi template, as a debugging and discovery measure. Is there a way to do it?
推荐答案
标准Python函数 locals()(返回字典)对我有用.我正在使用Genshi 0.5.1,正如您将看到的,所有内容似乎都在__data__
中.
The standard Python function locals() (which returns a dict) works for me. I'm using Genshi 0.5.1, and as you'll see, everything seems to be in __data__
.
${repr(locals())}
这篇关于源氏-如何打印范围内的所有变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文