'Out': {},
'_': '',
'__': '',
'___': '',
'__builtin__': ,
'__builtin__': ,
'__builtins__': ,
'__builtins__': ,
'__name__': '__main__',
'_dh': ['/tmp/tmpx_16f0vp'],
'_i': '',
'_i1': 'globals()',
'_ih': ['', 'globals()'],
'_ii': '',
'_iii': '',
'_oh': {},
'_sh': ,
'_sh': ,
'exit': ,
'get_ipython': >,
'quit': }
tuoi = 23
globals()['tuoi'] = 25
print('So tuoi la:', tuoi)
Running the program results in:
So tuoi la: 25
The global namespace stores all global variables, ie in this example, the value of the variable can be changed using the globals () function. The returned dictionary is accessed and changed to 25.
Previous lesson: Getattr () function in Python
Next lesson: Python locals () function