分享一段代码,很简单但是也很实用。 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
部排序指的是大文件的排序,即待排序的记录存储在外存储器上,待排序的文件无法一次装入内存,需要在内存和外部存储器之间进行多次数据交换,以达到排序整个文件的目的。我们一般提到排序都是指内排序,比如快速排序,堆排序,归并排序等,所谓内排序就是可以在内存中完成的排序。RAM的访问速度大约是磁盘的25万倍,我...
分类:
其他好文 时间:
2014-07-12 08:43:31
阅读次数:
313
分享一段代码,很简单但是也很实用。 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
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