N = 12
class Test(object):
def p(self):
print N + 1
t = Test()
t.p()
输出:
13
---------------------------------------
为什么不需要在"print N + 1"前面加上"global N"?
class Test(object):
def p(self):
print N + 1
t = Test()
t.p()
输出:
13
---------------------------------------
为什么不需要在"print N + 1"前面加上"global N"?
