|
|
发表于 2024-7-10 21:50:36
|
显示全部楼层
def is_public(name):
return not name.startswith('_')
def is_callable_attribute(obj, name):
return callable(getattr(obj, name))
a = [1]
callable_methods = [
name
for name in dir(a)
if is_public(name) and is_callable_attribute(a, name)
]
|
|