[Python] How do I check if a variable exists?

Discussão em 'Python' iniciado por Stack, Junho 3, 2025.

  1. Stack

    Stack Membro Participativo

    I want to check if a variable exists. Now I'm doing something like this:

    try:
    myVar
    except NameError:
    # Do something.


    Are there other ways without exceptions?

    Continue reading...

Compartilhe esta Página