Convert '165.0' to int

Billy Mays noway at nohow.com
Sat Jul 23 11:12:18 EDT 2011


On 7/23/2011 3:42 AM, Chris Angelico wrote:
>
> int(s.rstrip('0').rstrip('.'))
>

Also, it will (in?)correct parse strings such as:

'165............00000000000000'

to 165.

--
Bill



More information about the Python-list mailing list