Convert a value to a string. If no value is given, an empty string ""
is returned.
When bytes are converted to str then the data will be checked if it contains valid UTF-8 characters. If this is not the case, a value_err() will be raised.
This function does not generate a change.
str(value)
Argument | Type | Description |
---|---|---|
value | any (optional) | The value to create a string from. |
A new string
This code shows some return values for str():
[
str(),
str(42),
str(true)
];
Return value in JSON format
[
"",
"42",
"true"
]