Вот мой код:Python Ошибка: локальная переменная обращаться до назначения
import time
GLO = time.time()
def Test():
print GLO
temp = time.time();
print temp
GLO = temp
Test()
Traceback (most recent call last): File "test.py", line 11, in Test() File "test.py", line 6, in Test print GLO UnboundLocalError: local variable 'GLO' referenced before assignment
произошла ошибка, когда я добавить GLO = temp
, если я комментирую его, функция может быть успешно выполнить, почему?
Как установить GLO = temp
?