Thursday, August 1, 2019

Python Program | Convert int to str in Python

str() is a built-in function used to convert integer to string in python. By converting numbers into strings you can avoid "TypeErrors".

str() built-in function can be used to convert integer object into string in python. 
Since Python does not implicitly typecast floats and integers to strings.


str(object, encoding=encoding, errors=errors)


str() function converts integer and float literals into string. String literals are denoted by single or double quotation marks.

Example: "Hello World" and 'Hello World' is same

Let's look at an example:

'blue' + str(45)


Note: You can use three double quotes to assign a multiline string.

Related Posts:

If You Enjoyed This, Take 5 Seconds To Share It