标签:main __name__ eve pytho start int imp func 切换
1.gevent执行import gevent
def func1():
print(‘func1 start‘)
gevent.sleep(2)
print(‘func1 end‘)
def func2():
print(‘func2 start‘)
gevent.sleep(1)
print(‘func2 end‘)
def func3():
print(‘func3 start‘)
gevent.sleep(0)
print(‘func3 end‘)
if __name__==‘__main__‘:
gevent.joinall([
gevent.spawn(func1),
gevent.spawn(func2),
gevent.spawn(func3),
])
>>:
func1 start
func2 start
func3 start
func3 end
func2 end
func1 end
标签:main __name__ eve pytho start int imp func 切换
原文地址:http://blog.51cto.com/13803166/2140370