开发者

replace only one variable in web.py templates

I am passing variable to template in web.py and have the same condition in some places. Like this:

$if myvar=="string1":

$p开发者_StackOverflow社区assed argument1

............

$if myvar =="striung2":

$passed argument2

If say myvar is "string1" and I pass passed = "AAA" then I have AAA argument1 on my page, but the other if statements get replaced by empty string?

How to avoid that? I.e. how to leave other statements intact?


Your question is unclear. What are you trying to do? It sounds like you just need to use else:

if myvar == "string1":
  print passed
else:
  # something

But it's very hard to understand what you are asking.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜