python – time.sleep – 睡眠线程
import time from threading import Thread class worker(Thread): def run(self): for x in xrange(0,11): print x time.sleep(1) class waiter(Thread): def run(self): for x in xrange(100,103): print x time.sleep(5) def run(): worker().start() waiter().start()
运行结果:
0
100
1
2
3
4
5101
6
7
8
9
10210
运维虐我千万遍,我对运维如初恋。