如果我有以下代码:
class Foo(object): bar = 1 def bah(self): print(bar) f = Foo() f.bah()
它报错了
NameError: global name 'bar' is not defined
如何在方法bah中访问类/静态变量bar?
bar
用户名或邮箱地址
密码