【发布时间】:2020-03-31 02:58:14
【问题描述】:
我需要在 django 模板标签中执行 split() 函数。 我试图这样做,但它不起作用
{% for m in us.member %}
{% with mv=((m.split(','))[0].split('='))[1] %}
<h3 class="media-title">
{{ mv }}
</h3>
{% endwith %}
{% endfor %}
这里m的值返回一个字符串值
'cn=RND3,ou=Production_test,dc=iss,dc=rndtest,dc=local'
预期输出为 RND3
【问题讨论】:
-
这能回答你的问题吗? how to split the string in django template?
-
不,它可以解决这个问题
标签: python django django-forms django-templates django-views