python - 在没有上下文变量的模板中循环
问题描述
可以使用仅使用数字而不是模板中的上下文变量的循环,例如:
{% for (int i = 22; i < 65; ++i) %}
<input id="name_{{i}}" type="number" value="{{i}}">
{% endfor %}
如果可以做到,我该怎么做?提前致谢。
解决方案
You can just use:
for i in range(22,64):
推荐阅读
- visual-studio-code - 有没有办法在 Visual Sudio Code 1.56.2 中将默认 shell 永久设置为命令提示符?
- discord.js - 我需要帮助修复错误,我尝试了多种不同的方法来修复它,但我没有成功
- bash - 如何在 Bash 中的命令的先前 xargs 的管道的 grep 输出上运行类似 xargs 的命令
- delay - VB2019 睡眠/延迟,GUI 仍在更新
- c++ - 将简单十进制转换为十六进制的最佳方法以及 32 位和 64 位的重要性?十进制字符串?转换?
- postgresql - 如何在postgresql中查找用户创建日期以及所有权限
- linux - ansible 模块如何触发特定的 linux 命令?
- javascript - 字体真棒在 CSS 伪代码中不起作用
- ios - 无法在 ios 上选择初始时间值
- powershell - PowerShell 变量有限制吗?