-1

I have a string '3,505.92' recognized from image, I have to convert into float, So i'm trying float('3,505.92'). But I'm getting error that saying

could not convert string to float: '3,505.92'

I don't want to remove comma.

Rakshith N
  • 15
  • 6

1 Answers1

0

You have to remove the comma if you want to convert it to float, use string.replace()

float('3,505.92'.replace(',', ''))
Fabian
  • 11
  • 3