开发者

inserting commas to separate large number?

开发者 https://www.devze.com 2023-01-08 11:58 出处:网络
HI Is there a way i can add commas to a nu开发者_如何学Pythonmber like so: num= 1234567 then becomes

HI

Is there a way i can add commas to a nu开发者_如何学Pythonmber like so:

num= 1234567

then becomes

num = 1,234,567

I would like to make this call in my helper i.e module

thanks


Use number_with_delimiter.

From your helpers:

number_with_delimiter(12345678)       # => 12,345,678

UPDATE: The code for the method.

0

精彩评论

暂无评论...
验证码 换一张
取 消