Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Python str() Function

Python str() Function

Python built-in function Python built-in function


Description

The str() function converts an object into a human-readable form.

Syntax

The following is the syntax of the str() method:


class str(object='')

Parameters

Return Value

Returns the string form of an object.


Example

The following examples demonstrate the use of the str() method:

s

=

'

RUNOOB

'

str

(

s

)

'

RUNOOB

'

dict

= {

'

runoob

'

:

'

runoob.com

'

,

'

google

'

:

'

google.com

'

}; >>>

str

(

dict

)

"

{'google': 'google.com', 'runoob': 'runoob.com'}

"

Python built-in function Python built-in function