Wieso funktioniert
Code: Alles auswählen
VERSION = '1.0_SL1'
ns = 'test'
def __test():
print ns
print VERSION
#ns = 'f'
if __name__ == "__main__":
print VERSION
print ns
__test()
Code: Alles auswählen
VERSION = '1.0_SL1'
ns = 'test'
def __test():
print ns
print VERSION
ns = 'f'
if __name__ == "__main__":
print VERSION
print ns
__test()
1.0_SL1
test
Traceback (most recent call last):
File "C:\Users\Empi\Desktop\CDB_LoadBalancing\src\test.py", line 15, in <module>
__test()
File "C:\Users\Empi\Desktop\CDB_LoadBalancing\src\test.py", line 7, in __test
print ns
UnboundLocalError: local variable 'ns' referenced before assignment