无法加密字符串并将其插入sqlite

Can't encrypt a string and insert it into sqlite

我正在尝试将密码存储到 sqlite 数据库中,但出现错误:

Traceback (most recent call last):
  File "/media/luis/Vista/Users/Administrador/PycharmProjects/PNV/sqlitetesting.py", line 33, in <module>
    """, encriptado)
TypeError: function takes exactly 1 argument (2 given)

我正在使用 python 2.7、sqlite3 和 hashlib。这是代码:

    print "Password nao definida"
passadefinir = raw_input("Insira a sua password:")
clear()
passadefinir2 = raw_input("Insira novamente a sua password")
if passadefinir == passadefinir2:
    maindb.execute("DELETE FROM Password WHERE ID = 'not'")
    maindb.execute("INSERT INTO Password(ID) VALUES ('set')")
    encriptacao = hashlib.sha1(passadefinir2.encode())
    encriptado = (encriptacao.hexdigest(),)
    print (encriptado)
    maindb.executescript("""
    UPDATE Password
    SET Password = ?
    WHERE ID = 'set';
    """, encriptado)
    conn.commit()

使用maindb.execute代替maindb.executescript:

maindb.execute("""
UPDATE Password
SET Password = ?
WHERE ID = 'set';
""", encriptado)