【发布时间】:2012-04-25 12:13:39
【问题描述】:
如何使用hasattr(或不使用)检查函数或方法中是否存在attr?
当我尝试以任何方式检查它是否为 False 时:
>>> def f():
at = True
>>> hasattr(f, 'at')
False
>>> hasattr(f(), 'at')
False
【问题讨论】:
-
您希望如何处理这些信息?
标签: python attributes hasattr