摘要:
import multiprocessing,threadingimport timeimport osdef threading_run(): print("线程ID",threading.get_ident())t=threading.Thread(target=threading_run)de 阅读全文
摘要:
import threading,time,queueq=queue.Queue(maxsize = 10)def product(name): count = 1 while True: q.put(count) print("%s生产了%s个骨头"%(name,count)) count += 阅读全文
摘要:
import threadingimport timeevent=threading.Event()def lighter(): count = 0 while True: if count < 5: event.set() print("\033[1;42m;green light is on \ 阅读全文
摘要:
1、cat /etc/inittab 设定机器的运行级别: # 0 - halt (Do NOT set initdefault to this) # 1 - Single user mode # 2 - Multiuser, without NFS (The same as 3, if you d 阅读全文
摘要:
显示颜色格式:\033[显示方式;字体色;背景色m......[\033[0m] 字体色 | 背景色 | 颜色描述 30 | 40 | 黑色 31 | 41 | 红色 32 | 42 | 绿色 33 | 43 | 黃色 34 | 44 | 蓝色 35 | 45 | 紫红色 36 | 46 | 青蓝色 阅读全文
摘要:
import threadingimport timedef run (n): semaphore.acquire() time.sleep(1) print("run threading :",n) semaphore.release()semaphore=threading.BoundedSem 阅读全文
摘要:
线程的使用书写示例:(1)import threadingimport timedef run(str1): print("task:", str1) time.sleep(5) for i in range (30): t1 = threading.Thread(target= run ,args 阅读全文