globals 1
This commit is contained in:
parent
d4bdd11e31
commit
09f92d9179
16
python-temel/globals.py
Normal file
16
python-temel/globals.py
Normal file
|
@ -0,0 +1,16 @@
|
|||
x = 10
|
||||
y = 20
|
||||
|
||||
def foo():
|
||||
print('foo')
|
||||
|
||||
g = globals()
|
||||
|
||||
val = g['x']
|
||||
print(val)
|
||||
|
||||
val = g['y']
|
||||
print(val)
|
||||
|
||||
val = g['foo']
|
||||
print(val)
|
Loading…
Reference in New Issue
Block a user