def currency2(dollars): try: dollars = float(dollars) except ValueError: return dollars # Convert to cents (integer) cents = int(dollars * 100) return currency_format(cents)
def currency(cents): return currency_format(cents)