formattazione cifra con decimali

N

Nuke

Ho cercato un poco sulla documentazione di python senza trovare una
risposta soddisfacente al mio problema, quindi spero di trovare un
aiuto qui.
Ho creato un programmino che mi fa alcuni calcoli e riepiloghi
personali e vorrei visualizzare i totali numerici in euro con la
formattazione comprensiva dei separatori decimali.

Per esempio ho un totale scritto attualmente così: 50320,12 e
vorrei che si visualizzasse cosi: 50.320,12

esiste già una qualche funzione che mi formatta il numero (o la
stringa eventualmente) in questo modo?

Grazie a chi saprà darmi una risposta in merito.
 
N

Nuke

Nuke ha scritto:
Ho cercato un poco sulla documentazione di python senza trovare una
risposta soddisfacente al mio problema, quindi spero di trovare un
aiuto qui.
Ho creato un programmino che mi fa alcuni calcoli e riepiloghi
personali e vorrei visualizzare i totali numerici in euro con la
formattazione comprensiva dei separatori decimali.

Per esempio ho un totale scritto attualmente così: 50320,12 e
vorrei che si visualizzasse cosi: 50.320,12

esiste già una qualche funzione che mi formatta il numero (o la
stringa eventualmente) in questo modo?

Grazie a chi saprà darmi una risposta in merito.


Sorry for the language, i think the group was in italian language...
sorry :(
I try to explain my problem in english:

I need to visualize a number (or a string of that number) using the
decimal separator.
i have this number visualized: 50320,12 and i need that the
visualization of this number is: 50.320,13.
There is a function that directly convert the number (or the string) ?

Thank in advance, and sorry again for the language used before.
 
J

Jerry Hill

I need to visualize a number (or a string of that number) using the
decimal separator.
i have this number visualized: 50320,12 and i need that the
visualization of this number is: 50.320,13.
There is a function that directly convert the number (or the string) ?

I'm not very familiar with locale-aware programming in Python, but
this may get you started:
'Italian_Italy.1252'
'50.320,12'

See http://docs.python.org/lib/module-locale.html for documentation on
the locale module.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,070
Latest member
BiogenixGummies

Latest Threads

Top