Skip to content

Instantly share code, notes, and snippets.

@marcoscastro
Created February 23, 2017 22:00
Show Gist options
  • Select an option

  • Save marcoscastro/2d7fb3919b38d16f1a8a74058d9088f1 to your computer and use it in GitHub Desktop.

Select an option

Save marcoscastro/2d7fb3919b38d16f1a8a74058d9088f1 to your computer and use it in GitHub Desktop.
Código corrigido POO
def buscar_email(self, email):
"""Busca um cliente pelo email"""
try:
cursor = self.conexao.cursor()
# obtém todos os dados
cursor.execute("SELECT * FROM clientes WHERE email = ?",[(email)])
cliente = cursor.fetchone()
if cliente:
print('True')
else:
print('False')
except AttributeError:
print('Faça a conexão do banco antes de buscar clientes.')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment