
November 15th, 2012, 04:14 AM
|
|
Contributing User
|
|
Join Date: Jul 2007
Location: Joensuu, Finland
|
|
Quote: | Originally Posted by looptyloop How can I get a float, say 1.0 to print 1.00?
My goal is to make it look like dollars and cents. |
Code:
>>> amount = 1
>>> print('{0:.2f}'.format(amount))
1.00
__________________
My armada: openSUSE 12.3 (home desktop, laptop, work desktop), Ubuntu 12.04 LTS (mini laptop), Debian GNU/Linux 7.0 (server), Mythbuntu 12.04 LTS (HTPC), Bodhi Linux 2.0 & Windows 7 Ultimate (test desktop), FreeBSD 9.1 (test server)
|