首页 > 编程语言 > 详细

python 异步线程简单实现

时间:2014-10-15 17:24:12      阅读:383      评论:0      收藏:0      [点我收藏+]
import threading

def foo():
    with open(r‘./result.log‘,‘wb‘) as f:
        f.write(‘=some logs here ==‘)

t = threading.Thread(foo)
t.start()

当然你也可以用高级方法,参考这,https://docs.python.org/2/library/multiprocessing.html?highlight=apply_async  

python 异步线程简单实现

原文:http://www.cnblogs.com/Tommy-Yu/p/4026725.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!