__MagicPower
Do one thing and do it best!

导航

 
#!/usr/bin/env python
#--*-- coding:utf-8 --*--
__author__ = 'Kevin'

import MySQLdb as mdb
import sys

con = mdb.connect('localhost','root','redhat','test')

try:
    with con:
        cur = con.cursor()
        cur.execute("UPDATE Writers SET Name = %s WHERE Id = %s",("Guy de Maupasant","3"))
    print "Number of rows updated: %d" % cur.rowcount
finally:
    con.close()

 Result:

Number of rows updated: 1

 

posted on 2016-01-05 15:48  __MagicPower  阅读(107)  评论(0编辑  收藏  举报