Python str() FunctionPython Functions

Difficulty Level:
Difficulty Level:

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

Example

#!/usr/bin/python3
# -*- coding: UTF-8 -*-

s = '2019'
print(s)

dict = {'A': '1', 'B': '2'};
print(dict)

Output:

2019
{'A': '1', 'B': '2'}

Syntax

str(object)

Parameters

object — any object

Return Value

It returns a string object.

Advertisement

© 2021 Pythonexample.org, all rights reserved. Privacy Policy | Contact Us