[Python] Is there a way to check if a variable is of type List[List[str]] or of type List[str]...

Discussão em 'Python' iniciado por Stack, Setembro 11, 2025.

  1. Stack

    Stack Membro Participativo

    I want to do something like :

    if exact_type(var) == List[List[str]]:
    do something
    elif exact_type(var) == List[str]:
    do another thing


    but all I found was the type(var) function which would only return list. How can I check for the exact type of the object?

    Continue reading...

Compartilhe esta Página