我正在执行以下操作:
{% 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]
.
知道有什么问题/如何做到这一点吗?谢谢,