Tuesday, 20 August 2013

How do you do math in a mako template?

How do you do math in a mako template?

Assuming I have two variables "one" and "two" where they equal 1 and 2
respectively. How can I divide them in a mako template if possible? I want
something like:
${"{0:.2f}".format(one/two)}
The result I want to output in the template is: 0.50
I am using python 2.x.

No comments:

Post a Comment