ID EN
Built-in Types

str

Python 3.11

Return a string version of object. If object is not provided, returns the empty string. Otherwise, the behavior of str() depends on whether encoding or errors is given, as follows.

Syntax

PYTHON
class str(object='')

Examples

Example 1
PYTHON
>>> str(b'Zoot!')
"b'Zoot!'"

See Also

string type(object).__str__(object) __str__() str() repr(object) bytes-like object bytes bytearray