#!/usr/bin/env python
# coding: utf-8
VAR1 = 111
VAR2 = 222
VAR3 = 333
def func() :
VAR2 = 444
global VAR3
VAR3 = 555
print('--- in func() ---')
print('VAR1=' + str(VAR1) + ' そのまま参照(global変数)')
print('VAR2=' + str(VAR2) + ' 444 を上書き(local変数)')
print('VAR3=' + str(VAR3) + ' global宣言して 555 を上書き(global変数)')
print('--- (global in func()) ---')
print([item for item in globals().items() if not item[0].startswith('__')])
print('--- (local in func()) ---')
print([item for item in locals().items() if not item[0].startswith('__')])
print('***** START STATUS *****')
print('VAR1=' + str(VAR1))
print('VAR2=' + str(VAR2))
print('VAR3=' + str(VAR3))
print('************************\n')
func()
print('\n***** END STATUS *******')
print('VAR1=' + str(VAR1))
print('VAR2=' + str(VAR2))
print('VAR3=' + str(VAR3))
print('************************')