python解压,压缩,以及存数据库的相关操作
时间:2021-07-01 10:21:17
帮助过:21人阅读
os,shutil,zipfile,glob
def dfs_get_zip_file(input_path,result):
#
files =
os.listdir(input_path)
for file
in files:
if os.path.isdir(input_path+
‘/‘+
file):
dfs_get_zip_file(input_path+
‘/‘+
file,result)
else:
result.append(input_path+
‘/‘+
file)
def zip_path(input_path,output_path,output_name):
f = zipfile.ZipFile(output_path+
‘/‘+output_name,
‘w‘,zipfile.ZIP_DEFLATED)
filelists =
[]
dfs_get_zip_file(input_path,filelists)
for file
in filelists:
f.write(file)
f.close()
return output_path+r
"/"+
output_name
zip_path(r"./10",
‘D:‘,
‘wok.zip‘)
View Code
python解压,压缩,以及存数据库的相关操作
标签:ref 实现 util csdn lob input ret style 数据