Definition
The str() function converts the specified value into a string.
Syntax
str(object, encoding=encoding, errors=errors)
Parameters
Parameter | Description |
---|---|
object | Any object. Specifies the object to convert into a string |
encoding | The encoding of the object. Default is UTF-8 |
errors | Specifies what to do if the decoding fails |
Examples
myString = str(3.141516)
print(myString)