多线程demo

  • 多线程demo
from threading import Thread


class MyThread(Thread):
    def __init__(self, func):
        Thread.__init__(self)
        self.func = func

    def run(self):
        self.func()


def sayhello():
    print('hello')


if __name__ == '__main__':
    for i in range(3):
        t = MyThread(sayhello)
        t.start()
上一篇:Java方法第二章


下一篇:Java方法第二章