Checking if a string can be converted to float in Python
I’ve got some Python code that runs through a list of strings and converts them to integers or floating point numbers if possible. Doing this for integers is pretty easy if element.isdigit(): newelement = int(element) Floating point numbers are more difficult. Right now I’m using partition(‘.’) to split the string and checking to make sure … Read more