+ 4
A question
class A: def __str__(): return "sololearn" obj = A() print("sololearn"==obj) Why the output is False?
2 Answers
+ 13
class A:
def __str__(self):
return 'sololearn'
a = A()
print(str(a)=='sololearn')
0
class A:
def __str__():
return "sololearn"
obj = A.__str__()
print("sololearn"==obj)