摘要: 由于项目数据库要转到mysql,所以今天花了个把小时对python-mysql用法基本上了解了下,总结如下: 先来看一个代码:# -*- coding: utf-8 -*-import MySQLdb as mdbimport sys#将con设定为全局连接con = mdb.connect ('localhost', 'root', '', 'test');with con: #获取链接的cursor,只有获取了cursor, 我们才能进行各种操作 cur = con.cursor() #创建一个数据表 writers(id , 阅读全文
posted @ 2012-11-02 23:11 CodingMonkey 阅读(276) 评论(0) 推荐(0) 编辑