locale.format without trailing zeros

P

przemolicc

Hello,
'0,250000'

I need to print the numbers in the following format:
'0,2' (i)
'0,25' (j)
So the last trailing zeros are not printed.

Regards
Przemyslaw Bak (przemol)
 
A

Anssi Saari

Hello,

'0,250000'

I need to print the numbers in the following format:
'0,2' (i)
'0,25' (j)
So the last trailing zeros are not printed.

That would be the %g conversion specifier.
 
P

przemolicc

0,10000000000000001

How about this format:
',1'
(the local zero is also not printed)

(I know this is strange but I need compatibility with local requirements)

Regards
Przemyslaw Bak (przemol)
 
P

Peter Otten

How about this format:
',1'
(the local zero is also not printed)

(I know this is strange but I need compatibility with local requirements)

I believe you have to do it yourself:
',123'
 

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,770
Messages
2,569,586
Members
45,096
Latest member
ThurmanCre

Latest Threads

Top