分享一段代码,很简单但是也很实用。 1 #!/usr/bin/python 2 #-*- coding:gb18030 -*- 3 ''' 4 Usage: mq.py [Qmgr] 5 *get the queues' curdepth which type is local,...
分类:
编程语言 时间:
2014-07-16 23:06:47
阅读次数:
226
方法1:import sched, timeimport oss = sched.scheduler(time.time,time.sleep)#scheduler的两个参数用法复杂,可以不做任何更改defplaymusic(x):os.system(x)def jobtodo():tmlist =...
分类:
编程语言 时间:
2014-07-16 23:01:43
阅读次数:
235
上一篇中带参数的URLconf虽然可以做到传参动态显示内容,但是最终现实的内容还是硬编码到Python代码中的1 def hours_ahead(request,phours):2 try:3 phours = int(phours)4 except VauleErr...
分类:
其他好文 时间:
2014-07-12 08:52:40
阅读次数:
154
分享一段代码,很简单但是也很实用。 1 #!/usr/bin/python 2 #-*- coding:gb18030 -*- 3 ''' 4 Usage: mq.py [Qmgr] 5 *get the queues' curdepth which type is local,...
分类:
编程语言 时间:
2014-07-12 08:40:14
阅读次数:
502
http://eli.thegreenplace.net/2010/01/22/weighted-random-generation-in-python/类似俄罗斯轮盘赌
分类:
其他好文 时间:
2014-07-12 08:33:57
阅读次数:
177
分享一段代码,很简单但是也很实用。 1 #!/usr/bin/python 2 #-*- coding:gb18030 -*- 3 ''' 4 Usage: mq.py [Qmgr] 5 *get the queues' curdepth which type is local,...
分类:
编程语言 时间:
2014-07-12 08:05:13
阅读次数:
404
分享一段代码,很简单但是也很实用。 1 #!/usr/bin/python 2 #-*- coding:gb18030 -*- 3 ''' 4 Usage: mq.py [Qmgr] 5 *get the queues' curdepth which type is local,...
分类:
编程语言 时间:
2014-07-12 08:03:54
阅读次数:
373
http://www.cnblogs.com/twinsclover/archive/2012/04/26/2471704.html用python的BeautifulSoup分析htmlhttp://www.crummy.com/software/BeautifulSoup/bs3/documentation.zh.htmlBeautifulSoup中文文档1)搜索tag:find(tagname)#直接搜索名为tagname的tag如:find(‘head‘)find..
分类:
编程语言 时间:
2014-07-10 19:12:38
阅读次数:
265
1.下载安装cx_oracle安装包Python操作Oracle数据库,首先需要安装cx_Oracle包,下载地址如下:http://cx-oracle.sourceforge.net/http://sourceforge.net/projects/cx-oracle/files/5.1.2/本系统采用的是CentOS5.x系列的操作系统,python版本是2.4,于是下载支持python2.4版本..
分类:
数据库 时间:
2014-07-10 18:32:30
阅读次数:
263
我采用的是MySQLdb操作的MYSQL数据库。先来一个简单的例子吧:importMySQLdb
try:
conn=MySQLdb.connect(host=‘localhost‘,user=‘root‘,passwd=‘root‘,db=‘test‘,port=3306)
cur=conn.cursor()
cur.execute(‘select*fromuser‘)
cur.close()
conn.close()
exceptMySQLdb.Error,e..
分类:
数据库 时间:
2014-07-10 18:20:40
阅读次数:
282