1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
| import os import threading suffix = '.zip'
def extract(file): os.system("{exec} '{filename}' ".format(exec='un'+suffix[1:],filename=it))
def getPaths(path): res = os.listdir(path) return [ os.path.join(os.getcwd(),it) for it in res if it.endswith(suffix)]
if __name__=='__main__': try: for it in getPaths('./'): print('*****file****',it) t1 = threading.Thread(target=extract,args=(it, )) t1.start() t1.join() except: print ("Error: 无法启动线程")
|