擅长:python、mysql、java
<p>您可以使用<code>%(key)s</code>为您的查询定义关键字参数</p>
<pre><code>@app.route("/")
def index():
id = "Vishal"
p = "vishal94"
connection.execute("INSERT INTO books (username , password) VALUES (%(username)s, %(password)s)", {"username":id, "password":p})
dat = connection.execute("select * from books")
return render_template("data.html",dat = dat)
</code></pre>