How to turn a Qlineedit string into a float?

Asked

Viewed 70 times

0

Good night, you guys! I’ve been trying to turn the string of a Qline Edit into a float and I can’t!! Always returns the error saying I can’t convert string into float. What can I do to get around it? I’m trying so:

if float(self.qg_nodalloads[str(i)+str(0)].text())  > 0: 
   x =1
  • Which string you tried to convert?

  • I am trying both positive and negative integers and decimal numbers. It always returns "could not Convert string to float"

  • Could give examples?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.