What is the best possible way to check if a string can be represented as a number in Python?
The function I currently have right now is:
def is_numb
There is one exception that you may want to take into account: the string 'NaN'
If you want is_number to return FALSE for 'NaN' this code will not work as Python converts it to its representation of a number that is not a number (talk about identity issues):
>>> float('NaN')
nan
Otherwise, I should actually thank you for the piece of code I now use extensively. :)
G.