开发者

Python web.py template, how to escape (.) dot

开发者 https://www.devze.com 2023-04-09 18:36 出处:网络
In web.py template: index.html I wrote: $def with(s) <img 开发者_JAVA技巧src=\"$s.filename.png\" />

In web.py template: index.html I wrote:

$def with(s)
<img 开发者_JAVA技巧src="$s.filename.png" />

s.filename's value is "picuture" so I want to print

<img src="picture.png" />

but how can I tell web.py templating system do not to use $s.filename.png just use $s.filename and add ".png" to it?


See the Templetor docs:

Expression can be enclosed in () or {} for explicit grouping.

So, in your case,

<img src="${s.filename}.png" />
0

精彩评论

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

关注公众号