[Zope] Re: Python Function to Test for Integer Type

Max M maxm at mxm.dk
Tue Jun 15 18:50:05 EDT 2004


Asad Habib wrote:

> Hello. Does anyone know of a python function that returns a value based on
> whether or not its argument is an integer? Any help would be greatly
> appreciated. Thanks

from types import IntType
type(x) = IntType

or you can coerce it into an int:

x = int(x)

There are other approaches depending on what you want to achieve.

-- 

hilsen/regards Max M, Denmark

http://www.mxm.dk/
IT's Mad Science




More information about the Zope mailing list