ChinaUnix.net
相关文章推荐:

python 定时器

转: python 定时器 在编写服务进程的时候,往往需要定时落地一些数据,这就需要定时来执行一些操作,然后python中并没有合适的定时器(我没有找到),就自己diy吧。 view sourceprint?[code]import threading,time class Timer(threading.Thread): def __init__(self,fn,args=(),sleep=0,lastDo=True): threading.Thread.__init__(self) self.fn = fn self.args = args ...

by feiyang10086 - Python - 2011-06-03 16:19:06 阅读(3855) 回复(0)

php

相关讨论

初始化一个定时器,希望在不用的时候可以删除,但是总是不行,代码如下,哪里不对呢~~~ from threading import Timer from time import ctime, sleep class foo: def __init__(self): pass def disconnect(self): self.timer.cancel() print('dead...') def keepAlive(self): print('aliving...') self.timer = Timer(1, self.keepAlive) self.timer.start...

by markangelma - Python - 2011-09-07 10:44:40 阅读(8335) 回复(6)

给产品写脚本的时候,发现python居然没有 内置的定时器模块 虽然 while ture:sleep(1);可以解决问题 感觉还是不爽 后来,自己用c写了个定时器模块, 其中涉及调用关系,浪费了不少时间 python-> c-> python

by 印随 - Python - 2008-12-05 09:06:34 阅读(6455) 回复(3)

比如有两个函数:testA()和testB() 我想testA()3秒调用一次 testB()5秒调用一次 如果不能用time.sleep()

by 115300111 - Python - 2011-09-05 16:48:21 阅读(6800) 回复(9)

本帖最后由 gdp8899 于 2013-07-11 00:14 编辑 报表日期2013-03-31 一、营业总收入27,200,800,000.00

python

by feiyang10086 - Python - 2010-12-03 10:45:30 阅读(1490) 回复(0)

python is是种很特殊的语法,你在其它的语言应该不会见到这样的用法,今天就来说说这个把。 python is 按照自字面的意思就是什么东西是什么的,比如he is a boy,他是一个大男孩,而我们一般在写python程序的时候,也会用到一些判断,有的时候也会用到python is,比如判断下这个字符是否为none。 下面是python is的例子,比如我们来判断下一个字符串。 a = 'abc' if a is not None: print 'a is not none' 输出的结果是 a is not ...

by cucugbgb - Python - 2010-11-17 09:00:00 阅读(1645) 回复(1)

#!/urs/bin/python contact = {} contact_list = [] select = ['1.insert','2.delete'] for i in select: print i print 'what\'s your choise:' get = raw_input('1 or 2') if get == 1: test = 1 while test==1: contact['name'] = raw_input("please input name: ") contact['phone'] = raw_input("please input phone number: ") contact_list.append(contact.copy()) go_on = raw_input("continue?\n") ...

by linuxccc - Linux新手园地 - 2009-09-02 16:32:22 阅读(948) 回复(2)

好好学python,以后要养家吃饭的!!! 本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u2/89259/showart_1885773.html

by mzlinux - Python文档中心 - 2009-03-31 11:10:31 阅读(1369) 回复(0)