itzRafay itzRafay - 1 year ago 237
Python Question

How to convert String into Float?

I'm required to covert the variable:

pi_string = "3.1415926"

into a float. Here's what I'm dealing with:


Answer Source

Your line should be pi_float = float(pi_string)

float(pi_string) is a float value, you can not assign to it, because it is not a variable.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download