Formatting floats without trailing zeros

Me, I’d do ('%f' % x).rstrip('0').rstrip('.') — guarantees fixed-point formatting rather than scientific notation, etc etc. Yeah, not as slick and elegant as %g, but, it works (and I don’t know how to force %g to never use scientific notation;-).

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)