Python type checking?

Fredrik Lundh fredrik at pythonware.com
Wed Dec 8 03:03:23 EST 1999


<gregj at ancor.com> wrote:
> if (type(argvalue) == 'int'):
>   argvalue = long(argvalue)

type(value) return type objects, not strings.
better make that:

    if type(argvalue) is types.IntType:
        ...

or:

    if type(argvalue) is type(0):
        ...

</F>





More information about the Python-list mailing list