Quick: Format Specs in %

Philip Swartzleonard starx at pacbell.net
Wed Apr 24 16:41:14 EDT 2002


'%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.

-- 
Philip Sw "Starweaver" [rasx] :: www.rubydragon.com



More information about the Python-list mailing list