Peter Otten wrote:
> Last not least there's the option to employ locale-aware formatting:
Not quite last ... there's the mind-bending regular expression route:
import re
re.sub(r"(?<=\d)(?=(\d\d\d)+$)", ",", "12345678") # 12,345,678
re.sub(r"(?<=\d)(?=(\d\d\d)+$)", ",", "-54321")
Paul Volkov wrote:
> 2013/3/7 Peter Otten <__pete...@web.de>:
>> Last not least there's the option to employ locale-aware formatting:
>>
> import locale
> locale.setlocale(locale.LC_ALL, "en_US.UTF-8")
>> 'en_US.UTF-8'
> locale.format("%d", 12345, grouping=True)
>> '12,345'
>>
>> In Ge
2013/3/7 Peter Otten <__pete...@web.de>:
> Last not least there's the option to employ locale-aware formatting:
>
import locale
locale.setlocale(locale.LC_ALL, "en_US.UTF-8")
> 'en_US.UTF-8'
locale.format("%d", 12345, grouping=True)
> '12,345'
>
> In German usage of "." and "," is re
eli m wrote:
> I have a python program that accepts input and calculates the factorial of
> that number, and i want to know if i can make it so commas get inserted in
> the number. For example: instead of 1000 it would say 1,000
Last not least there's the option to employ locale-aware formatting:
On 3/6/2013 7:07 PM, Chris Rebert wrote:
On Wed, Mar 6, 2013 at 3:39 PM, eli m wrote:
I have a python program that accepts input and calculates the factorial of that
number, and i want to know if i can make it so commas get inserted in the
number.
For example: instead of 1000 it would say 1,0
On Wed, Mar 6, 2013 at 3:39 PM, eli m wrote:
> I have a python program that accepts input and calculates the factorial of
> that number, and i want to know if i can make it so commas get inserted in
> the number.
> For example: instead of 1000 it would say 1,000
Use the "," (i.e. comma) format(
On 03/06/2013 03:39 PM, eli m wrote:
I have a python program that accepts input and calculates the factorial of that
number, and i want to know if i can make it so commas get inserted in the
number.
For example: instead of 1000 it would say 1,000
pip install humanize
import humanize
my_int
I have a python program that accepts input and calculates the factorial of that
number, and i want to know if i can make it so commas get inserted in the
number.
For example: instead of 1000 it would say 1,000
--
http://mail.python.org/mailman/listinfo/python-list