views:

143

answers:

1

Anyone know how to format the length of a string with Mako?

The equivalent of print "%20s%10s" % ("string 1", "string 2")?

+2  A: 

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'
cobbal