返回顶部

收藏

Keyword Arguments Demo

更多
# Functions can also be called using keyword arguments of the form 
# 'keyword = value'.

def parrot(voltage, state='state', action='action', type='type'):
    print '-- Action:', action,
    print 'Vol', voltage 
    print '-- type:', type
    print '-- state', state

parrot(1000)
parrot(action = 'A', voltage = 1000000)
parrot('A', state = 'B')
parrot('A', 'B', 'C')

标签:Python,Function

收藏

0人收藏

支持

0

反对

0

发表评论