def safe_float(obj): try: retval = float(obj) except (ValueError, TypeError): retval = 'argument must be a number or numeric string' return retvalsafe_float('Spanish Inquisition')safe_float([])print safe_float('1.6')print safe_float(1.6)print safe_float(932)
Name (required)
email (will not be published) (required)
Website