Convert '165.0' to int

Hrvoje Niksic hniksic at xemacs.org
Fri Jul 22 08:42:04 EDT 2011


Frank Millman <frank at chagford.com> writes:

> int(float(x)) does the job, and I am happy with that. I was just
> asking if there were any alternatives.

int(float(s)) will corrupt integers larger than 2**53, should you ever
need them.  int(decimal.Decimal(s)) works with numbers of arbitrary
size.



More information about the Python-list mailing list