Javatpoint Logo
Javatpoint Logo

Python str() Function

Python str() converts a specified value into a string.

Signature

Parameters

object : It is the encoding of the object. The default value is UTF-8.

encoding : It is the encoding of the object. The default value is UTF-8.

errors : It specifies the actions that need to be performed if the decoding fails.

Return

It returns a string object.

Python str Function Example 1

The below example shows the working of str().

Output:

'4'

Explanation: In the above example, we have taken a string value 4 in the str and returns a string '4' as an output.







Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA