本文实例总结了python实现的MySQL增删改查操作。分享给大家供大家参考,具体如下:
代码片段一
连接并执行sql
#encoding:UTF-8
import MySQLdb
conn = MySQLdb.Connect(
host = '127.0.0.1',
port = 3306,
user = 'root',
passwd='123456',
db='imooc',
charset='utf8'
)
cursor = conn.cursor()
print conn
print cursor
sql = "select * from user"
curs