Python Convert Float to String

Last Updated On
Friday 27th May 2022

Python Convert Float to String

We can convert a float to a string using the str() and repr() functions.

Using str() Function

Syntax

	str(Object)
	

The str() method takes an object as input and converts it into a string type.

	floatNum = 0.432

string = str(floatNum)
print(string)
print(type(string))
	

Output

	0.432
<class 'str'>
	

Using repr() Function

Syntax

	repr(obj)
	

The repr() method takes an object as input and converts it into a printable string.

	floatNum = 0.432

string = repr(floatNum)
print(string)
print(type(string))
	

Output

	0.432
<class 'str'>
	
float to string python
convert float to string python
float string