python 代码 def xc(list_url,filename): urls = wz_url(list_url) pool = ThreadPool(10) # 设置线程数 try: results = pool.map(wz_content, urls) # 开始跑数据 except Exception, e: print '\033[1;31m 报错信息:\033[0m' + str(e) pool.close() pool.join() # 4 行代码结束 for result in results: filename.write(result + '\n') filename.close()
报错信息 Traceback (most recent call last): File "laonanren.py", line 105, in <module> xc(k,v) File "laonanren.py", line 80, in xc for result in results: UnboundLocalError: local variable 'results' referenced before assignment