在Python中计算阶乘

Ale*_*and 1 python syntax integer python-2.x

在计算时

math.factorial(100)
Run Code Online (Sandbox Code Playgroud)

我明白了:

93326215443944152681699238856266700490715968264381621468592963895217599993229915608941463976156518286253697920827223758251185210916864000000000000000000000000L

为什么数字末尾有一个L?

Joh*_*ooy 15

L意味着它是一个long而不是一个int.你看到它的原因是你正在看reprlong

您可以使用

print math.factorial(100)
Run Code Online (Sandbox Code Playgroud)

要么

str(math.factorial(100))
Run Code Online (Sandbox Code Playgroud)

如果你只是想要这个号码