įile "C:\Users\pc adam\Documents\EISTI\algoprog\perso\python\fichiers\btc\ETHtradingbotV1.py", line 138, in It's probably not the best way to do it, but it works when I test it alone.Īnyway, here is what I get when I run my entire code loading page. "remove prc" is a little function I created to remove the % of a number, here it is: def removeprc(string): #removes the % from a string as you will see later, the element retrieved is a number which should work with float() Ok so here is the code posing problem: old_values = is a selenium tool used to get a value of a website. It seems to be a common problem, but I've never seen it asked in the same situation I'm in. This Python write-up presented a complete guide on how to fix the “could not convert string to float” error.I'm coding a little bot in Python and I'm having a problem. The try-except block is also beneficial to rectify or handle this error in Python script. The “float()” function is used along with the combination of both these functions to convert the string value into float. findall()” and “ str.repalce()” functions are used to remove symbols and characters from the given string. To fix the “ ValueError: could not convert string to float”, the “ str.repalce()”, “ re.findall()” and “ try-except” is used in Python. The above output verified that the string value had been converted into a float value.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |