4.2 模块与范围:
character = 'Bob'
print(globals())
def localExample():
foo = '1'
print(locals())
localExample()
模块封装和属性:
import math
print(math.pi)
pi = 'apple'
print('our pi :%s'%pi)
print('math pi :%.5f'%math.pi)
pitemp = math.pi
math.pi = 'custard'
print('override:%s'%math.pi)
math.pi = pitemp
print('reassigned: %.5f'%math.pi)
<