“como verificar se o var existe python” Respostas de código

Como verificar se existe uma variável no Python

#if the variable is local: 
if 'myVar' in locals():
  # myVar exists

#if the variable is global:
if 'myVar' in globals():
  # myVar exists.
Worried Wryneck

como verificar se o var existe python

# for local
if 'myVar' in locals():
  # myVar exists.
# for globals
if 'myVar' in globals():
  # myVar exists.
Filthy Fish

Respostas semelhantes a “como verificar se o var existe python”

Perguntas semelhantes a “como verificar se o var existe python”

Procure respostas de código populares por idioma

Procurar outros idiomas de código