> what does 2 mean in %2.4f ?
In this case nothing because it will always be over-ridden by the 4.
Basically the first number specifies the *minimum* number of
characters output, ie 2 in this case.
The second number specifies the number of decimal placess
output, 4 in this case.
Since 4 decimal
Th format %x1.x2fwhere x1 is the total space and x2 is decimal digit place.If your data is longer than the specified x1 and x2.the data rules.Look at 3.14 takes 4 places total# 4 places rules
>>> '%3.2f' % 3.14'3.14'# perfect>>> '%4.2f' % 3.14'3.14'# try this >>> '%5.2f' % 3.14' 3.14'Cheers,pujo
O
On 12/20/05, Danny Yoo <[EMAIL PROTECTED]> wrote:
>
>
> On Mon, 19 Dec 2005, linda.s wrote:
>
> > what does 2 mean in %2.4f ?
>
> Hello,
>
> It's a "minimal field width" modifier, according to:
>
>http://docs.python.org/lib/typesseq-strings.html
>
>
> Let's try experimenting with it.
>
> ##
On Mon, 19 Dec 2005, linda.s wrote:
> what does 2 mean in %2.4f ?
Hello,
It's a "minimal field width" modifier, according to:
http://docs.python.org/lib/typesseq-strings.html
Let's try experimenting with it.
##
>>> '%20f' % 3.14
'3.14'
>>> '%20.2f' % 3.14
'
what does 2 mean in %2.4f ?
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor