上一页 1 ··· 12 13 14 15 16 17 18 19 20 ··· 30 下一页
摘要: #_author:来童星#date:2019/12/17#使用Thread创建线程import threadingimport timeclass Sunthread(threading.Thread): def run(self): for i in range(3): time.sleep(1) 阅读全文
posted @ 2019-12-17 14:53 Stary_tx 阅读(592) 评论(0) 推荐(0) 编辑
摘要: #_author:来童星#date:2019/12/17#使用threading模块创建线程import threading,timedef process(): for i in range(3): time.sleep(1) print('thread name is %s'%threading 阅读全文
posted @ 2019-12-17 14:46 Stary_tx 阅读(508) 评论(0) 推荐(0) 编辑
摘要: #_author:来童星#date:2019/12/17#使用队列在进程间通信from multiprocessing import Process,Queueimport time#向队列中写入数据def write_task(q):# 一定要将q传进去 if not q.full(): for 阅读全文
posted @ 2019-12-17 14:37 Stary_tx 阅读(201) 评论(0) 推荐(0) 编辑
摘要: #_author:来童星#date:2019/12/17#多进程队列的使用from multiprocessing import Queueif __name__=='__main__': q=Queue(3)# 初始化一个Queue对象,最多可接收3条put消息 q.put('消息1') q.pu 阅读全文
posted @ 2019-12-17 14:19 Stary_tx 阅读(759) 评论(0) 推荐(0) 编辑
摘要: #_author:来童星#date:2019/12/17#通过队列实现进程间通信from multiprocessing import Processdef plus(): print(' 子进程1开始 ') global g_num g_num+=50 print('g_num is %d'%g_ 阅读全文
posted @ 2019-12-17 14:11 Stary_tx 阅读(266) 评论(0) 推荐(0) 编辑
摘要: #_author:来童星#date:2019/12/17#通过队列实现进程间的通信from multiprocessing import Poolimport osimport timedef func(name): print('子进程(%s)执行func %s...'%(os.getpid(), 阅读全文
posted @ 2019-12-17 13:52 Stary_tx 阅读(329) 评论(0) 推荐(0) 编辑
摘要: #_author:来童星#date:2019/12/17#通过队列实现进程间的通信from multiprocessing import Poolimport osimport timedef func(name): print('子进程(%s)执行func %s...'%(os.getpid(), 阅读全文
posted @ 2019-12-17 13:50 Stary_tx 阅读(200) 评论(0) 推荐(0) 编辑
摘要: #_author:来童星#date:2019/12/17from multiprocessing import Processimport timeimport os#两个子进程将会调用的两个方法def child_1(i): print('子进程(%s)开始执行,父进程为(%s)'%(os.get 阅读全文
posted @ 2019-12-17 13:38 Stary_tx 阅读(226) 评论(0) 推荐(0) 编辑
摘要: #_author:来童星#date:2019/12/17# 使用Process子类创建进程from multiprocessing import Processimport timeimport os#继承Process类class SubProcess(Process): #由于Process类本 阅读全文
posted @ 2019-12-17 13:36 Stary_tx 阅读(395) 评论(0) 推荐(0) 编辑
摘要: #_author:Ltx#date:2019/12/16import timeimport randomclass account: ''' 1.存款功能 2.取款功能 3.打印交易详情 3.1--每次交易的时间 3.2--存款或者取款的金额 3.3每次交易后的金额 ''' def __init__ 阅读全文
posted @ 2019-12-16 14:26 Stary_tx 阅读(174) 评论(0) 推荐(0) 编辑
上一页 1 ··· 12 13 14 15 16 17 18 19 20 ··· 30 下一页