Print large values with format

0

As an example, if I have

f=10000000

print(f)

>>>1000000

but what I'm looking for is that instead of printing 1000000 I printed 1'000,000

I would like to know how I can get what I want.

Thanks

    
asked by Pedro Rincón Avalos 19.03.2018 в 16:31
source

1 answer

2

One way to make the separation as you are looking for it is:

"{:,}".format(100000)
  

// Print '100,000'

This method will first request the separator identifier to be used in this case and then access the format method and the amount you want to apply the separator.

    
answered by 19.03.2018 в 17:03