def flt(s, precision=None):
 if isinstance(s, basestring):
  s = s.replace(u',', u'')
 try:
  num = float(s)
  if (precision is not None):
   num = rounded(num, precision)
 except Exception:
  num = 0
 return num

def flt ( s , precision = None ) : if isinstance ( s , basestring ) : s = s . replace ( u',' , u'' ) try : num = float ( s ) if ( precision is not None ) : num = rounded ( num , precision ) except Exception : num = 0 return num
convert to float .