在 Python 中我定义了一个类:
class Myclass(BaseModule):
我想要打印参数 BaseModule。
像这样:
class Myclass(BaseModule):
logger.info("Argument=%s" % BaseModule.get_name())
不起作用:
unbound method get_name() must be called with BaseModule instance as
first argument (got nothing instead)
请您参考如下方法:
您可以通过以下方式访问类的名称:
BaseModule.__name__
