You assign s as an integer... it should be a float to get the right result...
So either define s as s = 14105.0 or as s = float(14105) it'll then result in the right answer : In [17]: s=14105.0 In [18]: s/1024 Out[18]: 13.7744140625 In [19]: s = float(14105) In [20]: s/1024 Out[20]: 13.7744140625 HTH - Geofram On 1/18/07, Johan Geldenhuys <[EMAIL PROTECTED]> wrote:
Hi all, In my script I want to convert 14105 bytes to kilobytes and and this is what I do: >>> s = 14105 >>> print '%0.2f' % (s/1024) 13.00 This not correct and I don't know why. The answer is 13.77. Any pointers please that would help my in the right direction? Thanks Johan -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.5.432 / Virus Database: 268.16.13/632 - Release Date: 2007/01/16 04:36 PM _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor