|
||||||||||||
|
|
| 收集的一些python程序,实用并且有趣 |
| 时间:22/04/2007 作者:网络 来源:网络 |
| 小提示→点这里把文章加入您的收藏夹,方便下次查看 |
| 设置文章字体大小:[大 中 小] |
|
这几天有空就做做python,下面是我收集的一些代码,大家可以看看,python真的很有有趣! 1。生成随机数 2。读文件 f = open("c:\\1.txt","r")
4。正则表达式,读取tomcat的日志并打印日期 import re 5。连接数据库 import pgdb conn = pgdb.connect(host='localhost',databse='qingfeng',user='qingfeng',password='123') cur = conn.cursor() cur.execute("select * from dream") print cur.rowcount 7。SAX处理xml: import string class QuotationHandler(saxlib.HandlerBase): def __init__(self): def startDocument(self): def startElement(self, name, attrs): def endElement(self, name): def characters(self, ch, start, length): if __name__ == '__main__': import Tkinter root=Tkinter.Tk() myLabel(root,"Welcome to python's world") myLabel.pack() root.mainloop() |
|
上一篇:如何扩充struts验证框架,进行多表单页面的验证
下一篇:FreeMarker设计指南(2) |
| 【返回】 【顶部】 【关闭】 |
| Copyright © 2005-2010 www.594k.com All Rights Reserved. |
| 版权所有:JAVA学习网
备案序号:皖ICP备06004238号 |