1. math.factorial(x)

import math
value = math.factorial(x)

2. reduce函数

def factorial(n):
    return reduce(lambda x,y:x*y,[1]+range(1,n+1))

3. 递归实现

def factorial(n):
    if n == 0:
        return 1
    else:
        return n * factorial(n - 1)