How to convert

Felipe Almeida Lessa felipe.lessa at gmail.com
Sat Mar 18 14:37:57 CET 2006


Em Sáb, 2006-03-18 às 05:12 -0800, Lad escreveu:
> How can I covert in Python  a variable of a long type to variable of
> Integer type?

You can do "int(variable)", but it can't be always done (for example,
when variable > MAX_INT):

>>> a=10L
>>> a
10L
>>> int(a)
10
>>> a=1000000000000000000000000000000000000000000000000000000000000000L
>>> a
1000000000000000000000000000000000000000000000000000000000000000L
>>> int(a)
1000000000000000000000000000000000000000000000000000000000000000L





More information about the Python-list mailing list