Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我已将 Python 列表传递给模板,例如
l=['text','there is no salary','I need alcohol','and I want be high']
我有id="raw"的模板文本区域。如何将列表 l 中的所有元素连接到一个字符串中并显示在 textarea 中?
你可以这样做:
<textarea>{{ l|join:"" }}</textarea>
请参阅模板过滤器上的Django 文档