python逗号分隔符_在Python中用逗号将数字打印为数千个分隔符

python逗号分隔符

什么是质数? (What is a prime number?)

Many times, while writing the code we need to print the large number separated i.e. thousands separators with commas.

很多时候,在编写代码时,我们需要打印大量的分隔符,即用逗号分隔数千个分隔符。

In python, such formatting is easy. Consider the below syntax to format a number with commas (thousands separators).

在python中,这种格式很容易。 考虑以下语法,以逗号分隔数字(千位分隔符)

    "{:,}".format(n)
    Here, n is the number to be formatted.

Given a number n, we have to print it with commas as thousands separators.

给定数字n ,我们必须用逗号将其打印为数千个分隔符。

Example:

例:

    Input:
    n = 123456789

你可能感兴趣的:(python,awk,正则表达式,机器学习,列表)