标签:while ted port open for dex log .sql merge
import glob big_file = open(‘index.sql‘, ‘rb‘) bak_file = ‘index_bak‘ i = 1 while True: chunk = big_file.read(200000) if not chunk: break file_write = open(bak_file + str(i) + ‘.sql‘, ‘wb‘) file_write.write(chunk) file_write.close() i+=1 big_file.close() big_file = ‘index2.sql‘ file_merge = open(big_file, ‘wb‘) list_file = glob.glob("index_bak*") list_file = sorted(list_file, key=lambda d:d[len(bak_file)+1]) print(list_file) for spt_file in list_file: big_file = open(spt_file, ‘rb‘) file_merge.write(big_file.read()) big_file.close() file_merge.close()
标签:while ted port open for dex log .sql merge
原文地址:http://www.cnblogs.com/xu-jian/p/6115809.html