2005年12月11日 星期日 18:54
哪位达人有Python操作MySQL的示例呀资料也行,主要就是更新操作比如添加删除修改等这些基本操作 本人E文不行希望得到中文资料 谢了 Love Python Love Life -------------------------------------------------------------------------- --------------------------------- 雅虎免费G邮箱-中国第一绝无垃圾邮件骚扰超大邮箱 雅虎助手¨D搜索、杀毒、防骚扰 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20051211/f84e7fc2/attachment.htm
2005年12月11日 星期日 22:09
在 05-12-11,伟 滕<tengwei6328 at yahoo.com.cn> 写道: > 哪位达人有Python操作MySQL的示例呀资料也行,主要就是更新操作比如添加删除修改等这些基本操作 > > 本人E文不行希望得到中文资料 http://phplens.com/lens/adodb/adodb-py-docs.htm 中文的也一样是E文代码哪……………… > 谢了 > > Love Python Love Life > > > -------------------------------------------------------------------------- > > ________________________________ > 雅虎免费G邮箱-中国第一绝无垃圾邮件骚扰超大邮箱 > 雅虎助手¨D搜索、杀毒、防骚扰 > > > _______________________________________________ > python-chinese > Post: send python-chinese at lists.python.cn > Subscribe: send subscribe to > python-chinese-request at lists.python.cn > Unsubscribe: send unsubscribe to > python-chinese-request at lists.python.cn > Detail Info: > http://python.cn/mailman/listinfo/python-chinese > > -- # Time is unimportant, only life important! ## 面朝开源,我心自由!
2005年12月11日 星期日 22:43
其实python读起来就和一般英语语法也差不多了:) On 12/11/05, Zoom Quiet <zoom.quiet at gmail.com> wrote: > 在 05-12-11,伟 滕<tengwei6328 at yahoo.com.cn> 写道: > > 哪位达人有Python操作MySQL的示例呀资料也行,主要就是更新操作比如添加删除修改等这些基本操作 > > > > 本人E文不行希望得到中文资料 > http://phplens.com/lens/adodb/adodb-py-docs.htm > 中文的也一样是E文代码哪……………… > > > 谢了 > > > > Love Python Love Life > > > > > > -------------------------------------------------------------------------- > > > > ________________________________ > > 雅虎免费G邮箱-中国第一绝无垃圾邮件骚扰超大邮箱 > > 雅虎助手¨D搜索、杀毒、防骚扰 > > > > > > _______________________________________________ > > python-chinese > > Post: send python-chinese at lists.python.cn > > Subscribe: send subscribe to > > python-chinese-request at lists.python.cn > > Unsubscribe: send unsubscribe to > > python-chinese-request at lists.python.cn > > Detail Info: > > http://python.cn/mailman/listinfo/python-chinese > > > > > > > -- > # Time is unimportant, only life important! > ## 面朝开源,我心自由! > > _______________________________________________ > python-chinese > Post: send python-chinese at lists.python.cn > Subscribe: send subscribe to python-chinese-request at lists.python.cn > Unsubscribe: send unsubscribe to python-chinese-request at lists.python.cn > Detail Info: http://python.cn/mailman/listinfo/python-chinese > >
2005年12月12日 星期一 17:37
在 05-12-11,Henotii<henotii at gmail.com> 写道: > 其实python读起来就和一般英语语法也差不多了:) > On 12/11/05, Zoom Quiet <zoom.quiet at gmail.com> wrote: > > 在 05-12-11,伟 滕<tengwei6328 at yahoo.com.cn> 写道: > > > 哪位达人有Python操作MySQL的示例呀资料也行,主要就是更新操作比如添加删除修改等这些基本操作 > > > > > > 本人E文不行希望得到中文资料 > > http://phplens.com/lens/adodb/adodb-py-docs.htm > > 中文的也一样是E文代码哪……………… > > > > > 谢了 > > > > > > Love Python Love Life > > > > > > > > > -------------------------------------------------------------------------- > > > > > > ________________________________ > > > 雅虎免费G邮箱-中国第一绝无垃圾邮件骚扰超大邮箱 > > > 雅虎助手¨D搜索、杀毒、防骚扰 > > > > > > > > > _______________________________________________ > > > python-chinese > > > Post: send python-chinese at lists.python.cn > > > Subscribe: send subscribe to > > > python-chinese-request at lists.python.cn > > > Unsubscribe: send unsubscribe to > > > python-chinese-request at lists.python.cn > > > Detail Info: > > > http://python.cn/mailman/listinfo/python-chinese > > > > > > > > > > > > -- > > # Time is unimportant, only life important! > > ## 面朝开源,我心自由! > > > > _______________________________________________ > > python-chinese > > Post: send python-chinese at lists.python.cn > > Subscribe: send subscribe to python-chinese-request at lists.python.cn > > Unsubscribe: send unsubscribe to python-chinese-request at lists.python.cn > > Detail Info: http://python.cn/mailman/listinfo/python-chinese > > > > > > _______________________________________________ > python-chinese > Post: send python-chinese at lists.python.cn > Subscribe: send subscribe to python-chinese-request at lists.python.cn > Unsubscribe: send unsubscribe to python-chinese-request at lists.python.cn > Detail Info: http://python.cn/mailman/listinfo/python-chinese > > #! -*- encoding:utf-8 -*- #!/usr/bin/python import _mysql #数据库全局参数设定 db_host = "localhost" db_name = "wikidb" db_user = "root" db_passwd = "100200300" db_port = 3306 db = None ############################## # #数据库操作 # ############################# def db_link(): global db_host, db_name, db_user, db_password, db_port db = _mysql.connect(host = db_host, user = db_user, \ passwd = db_passwd, db = db_name, port = db_port) return db ################################################ # #里程碑更新操作 # ############################################### def del_milestone(db): '''删除里程碑纪录''' if not db: db = db_link() _query = "delete from wm_summary_silestone" db.query(_query) if db: db.close() def get_milestone(db, alpha = 'Alpha 5', iterator = 0): '''获取里程碑数据''' if not db: db = db_link() #取得迭代5的总数 if iterator: _query = " SELECT COUNT(*) AS amount, SUM(req_done) AS done FROM wm_tbl_req where \ req_milestone = '"+alpha+"' and req_iterator = "+str(iterator) else: _query = " SELECT COUNT(*) AS amount, SUM(req_done) AS done FROM wm_tbl_req where \ req_milestone = '"+alpha+"'" db.query(_query) _result = db.use_result() _row = _result.fetch_row(maxrows = 0) if db: db.close() if not _row[0][1]: return (_row[0][0],0) else: return _row[0] def set_milestone(db,amount,done,alpha,iterator): if not db: db = db_link() _query =" insert into wm_summary_silestone (ss_amount,ss_done,ss_sile,ss_iterator) \ values ("+str(amount)+","+str(done)+",'"+str(alpha)+"',"+str(iterator)+")" #print _query db.query(_query) if db: db.close()
Zeuux © 2025
京ICP备05028076号