我无法访问sqlite3中的某些数据

时间:2019-07-02 12:41:48

标签: python sqlite

def login(usr,pwd):
    conn = sqlite3.connect('obj.db')
    cursor = conn.cursor()
    log_sql = 'SELECT pwd, id, turma, periodo FROM professores WHERE usr = ? AND pwd = ?'
    cursor.execute(log_sql,(usr,pwd))
    for i in cursor.fetchall():
        print(i)
    if cursor.fetchall():
        pass#I would like to return the id of the user who compared it in if
    else:
        print('login errado')

login(usr,pwd)

0 个答案:

没有答案