Formatting with mako

mako, python, template-engine

Solution

you can use python's string formatting fairly easily in mako

${"%20s%10s" % ("string 1", "string 2")}

giving:

>>> from mako.template import Template
>>> Template('${"%20s%10s" % ("string 1", "string 2")}').render()
'            string 1  string 2'

Problem

Anyone know how to format the length of a string with Mako? The equivalent of print "%20s%10s" % ("string 1", "string 2")?

Original source