[Python] How to compare type of an object in Python?

Discussão em 'Python' iniciado por Stack, Janeiro 30, 2025.

  1. Stack

    Stack Membro Participativo

    Basically I want to do this:

    obj = 'str'
    type ( obj ) == string


    I tried:

    type ( obj ) == type ( string )


    and it didn't work.

    Also, what about the other types? For example, I couldn't replicate NoneType.

    Continue reading...

Compartilhe esta Página