I need to convert some strings to float. Most of them are only numbers but some of them have letters too. The regular float() function throws an error.
a='56.78'
b='56.78 ab'
float(a) >> 56.78
float(b) >> ValueError: invalid literal for float()
One solution is to check for the presence of other characters than numbers, but I was wondering if there is some built-in or other short function which gives:
magicfloat(a) >> 56.78
magicfloat(b) >> 56.78