zipfile - Work with ZIP archives ZipFile.namelist() Return a list of archive members by name. 返回压缩成员名称列表 with ZipFile('spam.zip', 'r') as myzip: for f in myzip.namelist(): print(f) ZipFile.getinfo(name) Return a ZipInfo object with information about…
在python中编程导入压缩包,利用zipfile包,从zipinfo读取文件名总是出错,创建的文件名是乱码,写入pgsql更是出错. 但在ubuntu下测试却正常,在windows下测试总是失败. if not hdfs.exists_file_dir(dir): hdfs.make_dir(dir) hdfs.create_file(hpath, zip.read(info)) # There is no official file name encoding for ZIP files.…