在前面先定义myThread类
import threading
class myThread(threading.Thread):
def __init__(self, command):
threading.Thread.__init__(self)
self.cmd = command
def run(self):
print"Starting" + self.cmd
os.system(self.cmd)
print"Exiting" + self.cmd
使用:
thread1 = myThread('python daily_report_GUI.py')
# thread2 = ...
thread1.start()
# thread2.start()