标签:print def erro recent std cal function class ror
>>> def fn(): ... print("ok") ... >>> fn() ok >>> fn.s=123 >>> fn.s 123 >>> fn.ss Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: ‘function‘ object has no attribute ‘ss‘ >>> getattr(fn,"ss") Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: ‘function‘ object has no attribute ‘ss‘ >>> getattr(fn,"ss",2) 2 >>> b=getattr(fn,"sss",4) >>> b 4 >>>
标签:print def erro recent std cal function class ror
原文地址:https://www.cnblogs.com/Mengchangxin/p/10436529.html