I got a error when run python. Traceback (most recent call last): File "vartest0.py", line 8, in ? hi() File "vartest0.py", line 5, in hi path = os.path.join(path, 'hi') UnboundLocalError: local variable 'path' referenced before assignment
I wanna ask, who just do joke? python or me?
If python: print 'python joke a not jokable joke.' else: print 'I wanna learn more python.'
In your function hi(), the variable path is a new variable, only visible in this function. So when python say that you try to used it before assignement, it is right for the function visibility.
You have to say that you want use the global variable that has the same name :
def hi(): global path path = os.path.join(path,"hi") print path
But with this, the global variable is change every call to the hi() function.