标签:uri http names run https elf def href int
题目:
python中作用域的使用
详见[Blog][https://www.runoob.com/python3/python3-namespace-scope.html]
#!/usr/bin/python
# -*- coding: UTF-8 -*-
class Num:
__nNum__ = 1
def inc(self):
self.__nNum__ += 1
print('nNum = %d' % self.nNum)
if __name__ == '__main__':
nNum = 2
inst = Num()
for i in range(3):
nNum += 1
print('The num = %d' % nNum)
inst.inc()
标签:uri http names run https elf def href int
原文地址:https://www.cnblogs.com/lovely-bones/p/11643537.html