This is the P2PU Archive. If you want the current site, go to www.p2pu.org!
You haven't posted any discussions yet.
# This simple function will format a number into a dollar value with 2 decimals.
def convertDollar(number): return "$.2%f"%number
>>> convertDollar(100) $100.00
>>>convertDollar(501.1555) $501.16
Simple function with %f placeholder.
# This simple function will format a number into a dollar value with 2 decimals.
def convertDollar(number):
return "$.2%f"%number
>>> convertDollar(100)
$100.00
>>>convertDollar(501.1555)
$501.16