2024-05-16 07:11:48 发布
网友
我正在做以下工作:
{% for wrapping in wrappings %} //array of strings <input type="radio" value="{{ wrapping[:-3] }}" etc
我想输出所有的字符串,用换行方式减去最后3个字母,但收到一个:
TemplateSyntaxError: Could not parse the remainder: '[:-3]' from 'wrapping[:-3]。
TemplateSyntaxError: Could not parse the remainder: '[:-3]' from 'wrapping[:-3]
你知道怎么回事吗?谢谢
您可以使用切片过滤器:
{{ wrapping|slice:":-3" }}
你需要这个^{}过滤器。
{{ variable|slice:":-3" }}会做到的。
{{ variable|slice:":-3" }}
您可以使用切片过滤器:
你需要这个^{} 过滤器。
{{ variable|slice:":-3" }}
会做到的。相关问题 更多 >
编程相关推荐