Python读取Mysql数据库内容

Posted on 2008-11-06 16:51 Robert Su 阅读(803) 评论(0)  编辑  收藏
利用类库MySQLdb
实例代码如下:

import MySQLdb
conn 
= MySQLdb.connect("localhost","root","111","test")
c
=conn.cursor()
c.execute(
"""select * from name""")
out 
= c.fetchall();
print out

只有注册用户登录后才能发表评论。


网站导航:
 

posts - 103, comments - 104, trackbacks - 0, articles - 5

Copyright © Robert Su