Genshi - how to print out all variables in scope

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-11 00:42:56

问题


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?


回答1:


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())}


来源:https://stackoverflow.com/questions/1050452/genshi-how-to-print-out-all-variables-in-scope

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!