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" />
精彩评论