文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>[Python]操作Mysql

[Python]操作Mysql

时间:2011-03-07  来源:young40

Ubuntu下,直接

sudo apt-get install python-mysqldb

在Python代码中,需要import Mysql类库

from MySQLdb import *



连接并运行SQL语句

cn = Connection('localhost', 'root', '')
cn.select_db(
'yphp')
cur
= cn.cursor()
cur.
execute('SET NAMES UTF8')
cur.
execute('select id,url,content from yphp_spider_url where checked=0 limit 0,1')
rs
= cur.fetchone()
print rs
相关阅读 更多 +
排行榜 更多 +
学艺家

学艺家

学习教育 下载
画质鸭

画质鸭

游戏工具 下载
英雄塔楼

英雄塔楼

动作格斗 下载