Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有人知道如何用 Mako 格式化字符串的长度吗?
相当于print "%20s%10s" % ("string 1", "string 2")?
您可以在 mako 中相当轻松地使用 python 的字符串格式
${"%20s%10s" % ("string 1", "string 2")}
给予:
>>> from mako.template import Template >>> Template('${"%20s%10s" % ("string 1", "string 2")}').render() ' string 1 string 2'