adplus-dvertising
frame-decoration

Question

If a class defines the __str__(self) method, for an object obj for the class, you can use which command to invoke the __str__ method.

a.

obj.__str__()

b.

str(obj)

c.

print obj

d.

All of the mentioned

Posted under Strings in Python Python

Answer: (d).All of the mentioned

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. If a class defines the __str__(self) method, for an object obj for the class, you can use which command to invoke the __str__ method.