# -*- coding: utf-8 -*- import threading, time class testThread(threading.Thread): def run(self): for i in range(10): print 'thread(%s) --> %s' % (self.getName(), i) time.sleep(0) # context switching testThreads = [] for i in range(3): th = testThread() th.start() testThreads.append(th) for th in testThreads: th.join() print 'end'