callable函数

# 判断对象是否可调用,可调用,即对象后加()

s = "abc"
ls = [1,2,3]

def f():
    pass

class F():
    pass

t =(s, ls, f, F)
for obj in t:
    if callable(obj):
        print(obj, True)
    else:
        print(obj, False)
原文地址:https://www.cnblogs.com/ShuComputerProgram/p/10340785.html