On 7/22/2011 1:55 AM, Frank Millman wrote:
As the OP, I will clarify what *my* requirement is. This discussion has gone off at various tangents beyond what I was asking for.
Typical. Don't worry about it ;-).
As suggested above, I am only talking about a string containing int literals followed by '.' followed by zero or more zeros.
int(float(x)) does the job,
Not given that specification. >>> s='123456789012345678901.0' >>> int(float(s)) 123456789012345683968
and I am happy with that.
You should only be if you add 'with fewer than 18 digits' after 'int literals' to your spec.
I was just asking if there were any alternatives.
>>> int(s.split('.')[0]) 123456789012345678901 -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list