isinstance
def daniel(value):
if isinstance(value,dict):////
用来判断是不是这个类型的fuction
suga = sum(value.values())/len(value)
else:
suga = sum(value)/len(value)
return suga
mifa={"cc":12,"bb":22,"cc":33}
mifa1=[2,3,4]
print(daniel(mifa1))
>>> isinstance(3,int)
True
返回布尔值