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
how about this:
'3.14'.replace('.','',1).isdigit()
which will return true only if there is one or no '.' in the string of digits.
'3.14.5'.replace('.','',1).isdigit()
will return false
edit: just saw another comment ...
adding a .replace(badstuff,'',maxnum_badstuff)
for other cases can be done. if you are passing salt and not arbitrary condiments (ref:xkcd#974) this will do fine :P