Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
301 views
in Technique[技术] by (71.8m points)

python - is there any way to use variables like {{ ct{{ forloop.counter }} }} in HTML File in django?

views.py:

for i in range(1, 4):
    params[f"ct{i}"] = '<h1>ct'+i+ '</h1>'

index.html:

<h1>{{ct{{forloop.counter}} }}</h1>

Is there any way to use <h1>{{ct{{forloop.counter}} }}</h1> in My HTML File?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...