Convert '165.0' to int

Grant Edwards invalid at invalid.invalid
Thu Jul 21 10:13:15 EDT 2011

On 2011-07-21, Web Dreamer <webdreamer at> wrote:
> Leo Jay a ?crit ce jeudi 21 juillet 2011 11:47 dans 

> int(x.split('.')[0])
> But, the problem is the same as with int(float(x)), the integer number is
> still not as close as possible as the original float value.

Nobody said that "close as possible to the original float value" was
the goal.  Perhaps the OP just wants it truncated.

Grant Edwards               grant.b.edwards        Yow! OVER the underpass!
                                  at               UNDER the overpass!
                                Around the FUTURE and
                                                   BEYOND REPAIR!!

More information about the Python-list mailing list