Python 对mysql数据库的操作
#!.../usr/bin/python
# -*- coding: utf-8 -*-
import MySQLdb
class mysql:
def __init__(self, sql, host...where id=3')
conn.commit()
cur.close()
conn.close()
except MySQLdb.Error, e:
print "Mysql...):执行单条sql语句,接收的参数为sql语句本身和使用的参数列表,返回值为受影响的行数
executemany(self, query, args):执行单挑sql语句,但是重复执行参数列表里的参数,...返回值为受影响的行数
nextset(self):移动到下一个结果集
cursor用来接收返回值的方法:
fetchall(self):接收全部的返回结果行.
fetchmany(self, size=