[英]jinja2 variables naming - Are variables naming restrictions the same as for Python variables?
I did't find it written explicitly in the docs. 我没有在文档中明确写出它。
Are the naming rules the same as with Python variables? 命名规则与Python变量相同吗?
(eg: {{ a_variable'like_that' }}
doesn't work for example) (例如:
{{ a_variable'like_that' }}
无效)
Jinja's naming convention generally matches your python interpreter's identifiers. Jinja的命名约定通常与您的python解释器的标识符匹配。 So it also depends on your Python version ( 2.x : like
[a-zA-Z_][a-zA-Z0-9_]*
) 因此,这也取决于您的Python版本( 2.x :例如
[a-zA-Z_][a-zA-Z0-9_]*
)
(source: #pocoo on irc.freenode.net) (来源:irc.freenode.net上的#pocoo)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.