On 26 June 2013 23:02, <bandcam...@gmail.com> wrote: > Hello, i'm making a calculator and I want to be able to use decimals but I > don't like it when it comes out as ex.12.0 when it should be 12. I tried > using .rstrip("0".rstrip(".") but that never seemed to work. If anyone has a > solution please let me know, all help is greatly appreciated. > > Code: <LOTS 'O CODE>
Was that really necessary? All you needed to give use was "print(1.0)"; why post so much? Either: "{:g}".format(1.0) or, if you hate scientific notation: "{:f}".format(1.0).rstrip(".0") -- http://mail.python.org/mailman/listinfo/python-list