[Python]**otherInfo, *other

 

def person(age, **otherInfo):
    print(age)
    print(type(otherInfo))
    print(otherInfo)

person(age=15, sex='male', height=175, weight=56.7, hair='long')

 

运行结果:

15
<class 'dict'>
{'sex': 'male', 'height': 175, 'weight': 56.7, 'hair': 'long'}

 

 

 

def person(age, *other, height):
    print(age)
    print(type(other))
    print(other)

person(15, 'male', 56.7, 'long', height=175)

 

posted @ 2020-06-05 20:15  profesor  阅读(306)  评论(0编辑  收藏  举报