I have a class that has the __str__() method. An instance of the class 'a' is created. Is there a way of returning this instance name as a string when i print(a)
class MyClass:
def __str__(self):
return self
a = MyClass()
print(a)
I have a class that has the __str__() method. An instance of the class 'a' is created. Is there a way of returning this instance name as a string when i print(a)
class MyClass:
def __str__(self):
return self
a = MyClass()
print(a)