Quick: Format Specs in %
Fernando Pérez
fperez528 at yahoo.com
Wed Apr 24 17:13:15 EDT 2002
Philip Swartzleonard wrote:
>
> '%2f' % some_number pads the number with 2 blank spaces
> '%.2f' % some_number fixes the number to 2 decimal places
>
> the problem:
> '%2.2f' % some_number only does the second of those two things. I need
> both. I tried looking up the % operator in the index of the language
> reference, but couldn't find it.
>
For those quick questions, there's nothing like the PQR:
http://www.brunningonline.net/simon/python/PQR2.1.html
I actually keep a local copy permanently open while developing (it's a longish
document to download every time). Combined with opera's incremental search in
page (a la emacs), I typically find everything I need for such details in a
few seconds.
I hope the author has time to update it to 2.2 sometime.
Cheers,
f.
More information about the Python-list
mailing list