python之6-5偏函数

时间:2014-07-18 08:11:03   收藏:0   阅读:415
#!/usr/bin/env python

# coding=utf-8

print int(‘11‘,base=2)

def int2(x,base=2):

    print int(x,base)

int2(‘10‘,16)


root@aaa103439-pc:/home/aaa103439/桌面/python# python test6_偏函数.py 

3

16

#!/usr/bin/env python

# coding=utf-8

print int(‘11‘,base=2)

def int2(x,base=2):

    print int(x,base)

int2(‘10‘,base=16)

import functools

int3 = functools.partial(int,base=2)

print int3(‘10‘,base=16)


root@aaa103439-pc:/home/aaa103439/桌面/python# python test6_偏函数.py 

3

16

16

python之6-5偏函数,布布扣,bubuko.com

原文:http://www.cnblogs.com/aaa103439/p/3851156.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!