473,386 Members | 1,828 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

formattazione cifra con decimali

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.

Jan 9 '07 #1
2 3797

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.

Jan 9 '07 #2
On 9 Jan 2007 01:43:41 -0800, Nuke <an**********@gmail.comwrote:
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:
>>import locale
>>locale.setlocale(locale.LC_ALL, 'it')
'Italian_Italy.1252'
>>locale.format("%0.2f", 50320.12, grouping=True)
'50.320,12'

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

--
Jerry
Jan 9 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: Ney André de Mello Zunion | last post by:
Hello. Binding a temporary to a non-const reference is illegal. Everybody should be tired of hearing that. So should I. But then I found myself wondering about a small piece of code I was...
1
by: Luigi | last post by:
I noted a particular behavior shown by IE. Look at the simple page attached at the bottom of the post. In it, there is a box floated with the float property and another box that jumps it with the...
14
by: vittorio | last post by:
While I can compile the program below under freebsd via a simple: gcc prog1.c -o prog1 and it runs smoothly, I'm experiencing annoying problems with lcc-win32 under windows xp pro. In fact, under...
1
by: X~coder | last post by:
hy i'm a noobie too i tried to make a calculator that imputs an ecuation it is a consol program. i hope it can help you :) ex: 3+5*564-342^33/22-(34343-(((34^4+2)-2-6))+4)= the part of...
11
by: anushhprabu | last post by:
can any one give me idea to evaluate an string experssion.. (3+2-(4*3/5)+2 and so on.. it shld also check for the operator precedence... i finished this code using infix,postfix notations.. but...
2
by: Enzo Cavallaro | last post by:
Buon giorno a tutti, potreste spiegarmi come si fa a formattare con vb2005 un numero 1234 in 1.234,00 oppure un numero come 1255,00 in 1.255,00 Grazie a tutti
8
by: Darin | last post by:
Is there something in windows that will take a given set of numbers and re-write them as words - such as for a check? A friend wrote this macro for Excel and I didn't know if this was something...
2
by: paolo | last post by:
Thanks in advance to everyone that will give me help for these questions. The function formatCurrency is used to auto-format a numeric value with thousands separators and a decimal separator. ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.