#!/usr/bin/dev python
import sys
import os
g_nVal = 0;
g_strVal = "aaaa";
g_map = {
"aaa" : "111",
"bbb" : "222",
"ccc" : "333",
"ddd" : "444"
}
g_ls = ['a', 'b', 'c']
def FixInt(bGlobal = False):
if bGlobal:
global g_nVal;
g_nVal = g_nVal + 1;
def FixString(bGlobal = False):
if bGlobal:
global g_strVal;
#fix string value
g_strVal = g_strVal + 'b';
def FixMap(bGlobal = False):
if bGlobal:
global g_map;
#fix map value
g_map['aaa'] = 'aaa__' + g_strVal;
g_map['bbb'] = 'bbb__' + g_strVal;
g_map['ccc'] = 'ccc__' + g_strVal;
g_map['ddd'] = 'ddd__' + g_strVal;
def FixList(bGlobal = False):
if bGlobal:
global g_ls;
g_ls.append('1');
def PrintVal(strInfo):
if strInfo:
print("==== %s =====" %strInfo);
print("int value:%d" %g_nVal);
print("string value:%s" %g_strVal);
print("map value:%s" %g_map);
print("list value:%s" %g_ls);
print("nn");
if "__main__" == __name__:
PrintVal("The orgin vlaue");
FixInt();
FixString();
FixMap();
FixList();
PrintVal("print all bGlobal = False vlaue");
FixInt(True);
FixString(True);
FixMap(True);
FixList(True);
PrintVal("print all bGlobal = True vlaue");