How do I change my float into a two decimal number with a comma as a decimal point separator in python?
Question: I have a float: 1.2333333

How do I change it into a two decimal number with a comma as a decimal point
separator, eg 1,23?


Answer: The [locale module](http://docs.python.org/library/locale.html) can help you
with reading and writing numbers in the locale's format.

    
    
    >>> import locale
    >>> locale.setlocale(locale.LC_ALL, "")
    'sv_SE.UTF-8'
    >>> locale.format("%f", 2.2)
    '2,200000'
    >>> locale.format("%g", 2.2)
    '2,2'
    >>> locale.atof("3,1415926")
    3.1415926000000001
    

