adplus-dvertising
frame-decoration

Question

Which function is called when the following code is executed?
f = foo()
format(f)

a.

format()

b.

__format__()

c.

str()

d.

__str__()

Posted under Python

Answer: (d).__str__()

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. Which function is called when the following code is executed?