locals() Is Read-Only : Local Variables : Language Basics PYTHON examples


PYTHON examples » Language Basics » Local Variables »

 

locals() Is Read-Only


locals() Is Read-Only: globals() Is Not

def foo(arg)
    x = 
    print locals()             
    locals()["x"2          
    print "x=",x               

z = 
print "z=",z 
foo(3
globals()["z"8             
print "z=",z                   
           
       



    Related Scripts with Example Source Code in same category :

Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


PYTHON examples

 Navioo Language Basics
» Local Variables