Python 参数练习

今天看 Python 参数那一章,看到除了顺序参数、关键字参数之外还有 *para **para 的参数调用方式,类似于C里面的指针和指向指针的指针(好怀念),*para是指没有明确数量的参数元组 **是指没有明确数量的关键字参数字典,练习题如下:

def story(**kwds):
    return 'Once upon a time, there was a '\
           '%(job)s called %(name)s.' % kwds

def power(x, y, *others):
    if others:
        print 'Received redundant parameters:', others
    return pow(x, y)

def interval(start, stop=None, step=1):
    'Imitates range() for step > 0'
    if stop is None:
        start, stop = 0, start
    result = []
    i = start
    while i < stop:
        result.append(i)
        i += step
    return result

信息化的道路上一直看到听到大家撕逼,业务部门的、省里用户的、IBM的 顶上还有领导的欲求不满... 不开心  ̄へ ̄

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值