摘要:
#_author:来童星#date:2019/12/15import os#1# print(os.name)# nt >windows操作系统#2 用于获取当前操作系统的换行符# print(os.linesep)# 为什么不显示# # 用于获取当前操作系统所使用的路径分隔符# print(os. 阅读全文
摘要:
#_author:来童星#date:2019/12/13from datetime import datetimeclass medicine: name='' price=0 PD='' Exp='' def __init__(self,name,price,PD,Exp): self.name= 阅读全文
摘要:
#_author:来童星#date:2019/12/12import geventimport timedef func1(): print('\033[31;1mfun1 starting...\033[0m',time.ctime()) gevent.sleep(2) print('\033[3 阅读全文
摘要:
#_author:来童星#date:2019/12/12from greenlet import greenletdef test1(): print(12) gr2.switch() print(34) gr2.switch()def test2(): print(56) gr1.switch() 阅读全文
摘要:
#_author:来童星#date:2019/12/12def consumer(name): print(" >start...") while True: new_baozi = yield print("[%s] is eating baozi %s" % (name, new_baozi)) 阅读全文
摘要:
#_author:来童星#date:2019/12/11#1.拼接字符串mon_en='Remerbrance is a form of meeting,Frgetfulness is a form of freedom 'mon_cn='记忆是一种相遇,遗忘是一种自由'print(mon_en+' 阅读全文
摘要:
#_author:来童星#date:2019/12/11#Pipefrom multiprocessing import Process, Pipedef f(conn): conn.send([42, None, 'hello']) conn.close()if __name__ == '__ma 阅读全文
摘要:
#_author:来童星#date:2019/12/11#Managersfrom multiprocessing import Process, Managerdef f(d, l,n): d[n] = '1' d['2'] = 2 d[0.25] = None l.append(n) print 阅读全文
摘要:
#_author:来童星#date:2019/12/11# 进程间通讯 # 不同进程间内存是不共享的,要想实现两个进程间的数据交换,可以用以下方法:# Queues# 使用方法跟threading里的queue类似:from multiprocessing import Process, Queue 阅读全文
摘要:
#_author:来童星#date:2019/12/10#1.year=[89,98,00,75,68,37,58,90]for index,value in enumerate(year): if str(value)!='0': year[index]=int('19'+str(value)) 阅读全文