python-fun2

定义一个函数func(*argvs),该函数效果如下

func(222,111,‘xian’,‘hahaah’) --> 'xian'

func (7,'name','fensi') --> 'fensi'

func(1,2,3,4) ---> None

def func(*args):
    if not isinstance(args[2],int):
        return args[2]
    else:
        return None
li = [222,111,'xian','hahaah']
li1 = [7,'name','fensi']
li2 = [1,2,3,4]
print func(*li)
print func(*li1)
print func(*li2)


你可能感兴趣的:(python)