固定函数参数
import functools
int2 = functools.partial(int, base=2)
print(int('100', base=2))
//相当于
print(int2('100'))
将参数移到最左侧
import functools
max_10 = functools.partial(max, 10)
print(max(10,1,5,2))
//相当于
print(max_10(1,5,2))
固定函数参数
import functools
int2 = functools.partial(int, base=2)
print(int('100', base=2))
//相当于
print(int2('100'))
将参数移到最左侧
import functools
max_10 = functools.partial(max, 10)
print(max(10,1,5,2))
//相当于
print(max_10(1,5,2))