def smart_int(string, fallback=0):
 try:
  return int(float(string))
 except (ValueError, TypeError, OverflowError):
  return fallback

def smart_int ( string , fallback = 0 ) : try : return int ( float ( string ) ) except ( ValueError , TypeError , OverflowError ) : return fallback
convert a string to int .