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
原文地址:https://www.cnblogs.com/kevincaptain/p/10448557.html