码迷,mamicode.com
首页 > 编程语言 > 详细

线程,协程

时间:2019-01-01 19:54:00      阅读:151      评论:0      收藏:0      [点我收藏+]

标签:rom   sharp   int   target   线程   from   bsp   div   main   

 

1. 协程的创建.

#线程的创建
from threading import Thread
import time
def sayhi(name):
    time.sleep(2)
    print("%s say hello"%name)

if __name__ =="__main__":
    t =Thread(target=sayhi,args =("egon",))
    t.start()
    print("主线程")

  

线程,协程

标签:rom   sharp   int   target   线程   from   bsp   div   main   

原文地址:https://www.cnblogs.com/mengbin0546/p/10205603.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!