[ZDP] BackTalk to Document The Zope Book (2.6 Edition)/Appendix C:
Zope Page Templates Reference
webmaster at zope.org
webmaster at zope.org
Fri May 28 15:08:28 EDT 2004
A comment to the paragraph below was recently added via http://zope.org/Documentation/Books/ZopeBook/2_6Edition/AppendixC.stx#3-176
---------------
String formatting (format a float to two decimal places)::
<p tal:content="python:'%0.2f' % size">
13.56
</p>
% Anonymous User - Mar. 24, 2004 12:17 am:
How create 12345 to 12,345.00
% Anonymous User - May 28, 2004 3:08 pm:
One way:
<p tal:define="ps python:modules[''Products.PythonScripts.standard''];
varA python:12345;
varB python:''%0.2f'' % ( varA );
varC python:ps.thousands_commas( varB )"
tal:content="string:$$$varC">
Will print $12,345.00
</p>
k
More information about the ZDP
mailing list