python 使用functools.partial创建新的函数

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python 使用functools.partial创建新的函数相关的知识,希望对你有一定的参考价值。

# 使用functools.partial创建新的函数 
>>> import functools
>>> int2 = functools.partial(int, base=2)
>>> int2('1000000')
64
>>> int2('1010101')
85

以上是关于python 使用functools.partial创建新的函数的主要内容,如果未能解决你的问题,请参考以下文章