How to get rows affected in a UPDATE statement by PyMySQL?
<p>I need to update some rows on the MySQL database by PyMYSQL and I want to know <strong>how many rows had been changed.</strong></p>
<pre><code>import pymysql
db = pymysql.connect(xxxx)
cur = db.cursor()
sql = &quot;update TABLE set A = 'abc' where B = 'def'&quot;
cur.execute(sql, params)
db.commit()
</code></pre>