Convert '165.0' to int
t at jollybox.de
Thu Jul 21 11:53:43 CEST 2011
On 21/07/11 11:31, Frank Millman wrote:
> Hi all
> I want to convert '165.0' to an integer.
Well, it's not an integer. What does your data look like? How do you
wish to convert it to int? Do they all represent decimal numbers? If so,
how do you want to round them? What if you get '165.xyz' as input?
Should that raise an exception? Should it evaluate to 165? Should it use
> If I convert to a float first, it does work -
> Is there a short cut, or must I do this every time (I have lots of
> them!) ? I know I can write a function to do this, but is there anything
What's wrong with this? It's relatively concise, and it shows exactly
what you're trying to do.
More information about the Python-list