Convert float to string ...

  • Thread starter =?ISO-8859-1?Q?Konrad_M=FChler?=
  • Start date
?

=?ISO-8859-1?Q?Konrad_M=FChler?=

Hi,

a simple question but i found no solution:

How can i convert a float value into a string value?


string_value1 = string(float_value) + ' abc'


doesn't work ...

Thanks
Konrad
 
M

Matt Hammond

How can i convert a float value into a string value?

Try:
string_value1 = str(float_value) + ' abc'
or:
string_value1 = repr(float_value) + ' abc'


Type in an interactive python session.
help(str)
or:
help(repr)


regards


Matt
 
G

Grant Edwards

Hi,

a simple question but i found no solution:

How can i convert a float value into a string value?


string_value1 = string(float_value) + ' abc'

string_value1 = str(float_value) + ' abc'

Or the more versatile:

string_value1 = "%10.3f abc" % float_value
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,045
Latest member
DRCM

Latest Threads

Top