黄聪

论SEO对人类的重要性,请看我的博客:hcsem.com

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
import MySQLdb

#创建链接
conn=MySQLdb.Connect(host='localhost',user='root',passwd='',db="xingming")

#生成游标
cursor=conn.cursor()

#插入多条记录
cursor.executemany(
"""INSERT INTO xm (x, m)
VALUES (%s, %s)
""",
[
(
"h","c"),
(
"g","y")
] )

#查询
count=cursor.execute('select * from xm')
results
= cursor.fetchall()
for r in results:
print r

posted on 2011-09-04 08:27  黄聪  阅读(680)  评论(0编辑  收藏  举报