Bruno Desthuilliers 写道: > J. Peng a écrit : >> def safe_float(object): >> try: >> retval = float(object) >> except (ValueError, TypeError), oops: >> retval = str(oops) >> return retval > >> The code above works well. > > For which definition of "works well" ? > I got it from Core Python Programming book I bought.You may ask it to Westley Chun.:)