I am learning python3 and I want to know that how I can
class testit:
def assigna():
a = "Hi"
def geta(self):
print(self.a)
test = testit
print(test.geta())
How can I access a inside of geta
as suggested in comments I tried to use self.a
and it gives me an error.
Here is my Updated Code
class testit:
def assigna(self):
self.a = "Hi"
def geta(self):
print(self.a)
test = testit
print(test.geta())
and here is the error.
Traceback (most recent call last):
File "test.py", line 44, in <module>
print(test.geta())
TypeError: geta() missing 1 required positional argument: 'self'