[Tutor] Some questions about my yen-USD.py
Alan Gauld
alan.gauld at freenet.co.uk
Fri Sep 8 19:30:39 CEST 2006
> http://www.python.org/doc/current/lib/typesseq-strings.html
>
>>>> "%.*f" % (2, 2.234234)
> '2.23'
Cool! I'd never noticed this, or maybe just difdn't understand the
significance.
And it works for multiple values too:
>>> "%*.*" % (12,3,123.456789)
unfortunately 3 values won't work, it only works for numbers...
>>> "%**.*" % ('-', 12,3,123.456789)
Error...
Alan G
More information about the Tutor
mailing list