# 单个线程进行的工作 defsingleHandle(codes, test): print test for code in codes: # 去除code中的空白字符 code = code.strip() # 获取信息 getComInfo(code)
# 每次四个线程获取股票信息 defmultiHandle(fourcodes, test): threads = [threading.Thread(target=singleHandle, args=(codes, test)) for codes in fourcodes] for t in threads: t.start() for t in threads: t.join()
if __name__ == '__main__': codes = [] readCode("codes.txt", codes) num = len(codes) ifnot os.path.isdir("goodTicket"): os.mkdir("goodTicket") print"make dir pic"