python--多线程

import threading
from time import ctime


class MyThread(threading.Thread):
def __init__(self, func, args, name=''):
threading.Thread.__init__(self)
self.name = name
self.func = func
self.args = args

def getResult(self):
return self.res

def run(self):
print('starting ' + self.name + ' at: ' + ctime())
self.res = self.func(*self.args)
print(self.name + ' finished at: ' + ctime())

posted on 2018-02-04 11:05  我要的明天  阅读(141)  评论(0编辑  收藏  举报

导航