擅长:python、mysql、java
<p>试试这个:</p>
<pre><code>rows = (
{'gid': 10, 'furniture': 10, 'plant': 10},
{'gid': 20, 'furniture': 20, 'plant': 20}
)
cur.executemany(
'''
UPDATE myTable
SET
furniture = %(furniture)s,
plant = %(plant)s
WHERE
gid = %(gid)s
''',
rows
)
</code></pre>