How do I import a variable from another function in the same class
class W(object):
#my class
def variable(self):
#one of my functions
f = 5
def printf(self):
#what do i put here to import f from the function variable...
#I'm currently working with python 3.1.
#I know its not global f and for some reason when ever I try
#nonlocal f an error comes up saying "no binding for nonlocal "f" found"
#and highlights the first line...
print(f)
def main(self):
self.variable()
self.printf()
if __name__ == "__main__":
n = W()
n.main()