The str()
function is used to convert an object into its string representation. It can also be used without any argument to create an empty string.
str() #create an empty string
str(object) #get the string representation of the given object.
When the function is called without an argument, it simply returns an empty string.
When the function is called with an argument, it returns the string representation of the object. Any given object in Python possesses a string representation , rendering all objects as valid arguments to the str()
function.
A user defined object can override its default string representation by defining the __str__()
method.