zoukankan      html  css  js  c++  java
  • python中的zipfile

    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 the archive member name. Calling getinfo() for a name not currently contained in the archive will raise a KeyError.
    根据成员名称获取ZipInfo

    ZipFile.infolist()
    Return a list containing a ZipInfo object for each member of the archive. The objects are in the same order as their entries in the actual ZIP file on disk if an existing archive was opened.
    返回ZipInfo列表

    ZipFile.extract(member, path=None, pwd=None)
    ZipFile.extractall(path=None, members=None, pwd=None)
    解压缩文件,path指定路径(默认为当前路径)

    ZipFile.write(filename, arcname=None, compress_type=None)
    ZipFile.writestr(zinfo_or_arcname, bytes[, compress_type])
    写入, arcname压缩后成员名称
    with ZipFile('spam.zip', 'w') as myzip:
        myzip.write('eggs.txt')


  • 相关阅读:
    词向量的发展
    拉格朗日对偶理解
    EM算法理解
    Xgboost理解
    GBDT理解
    深入理解KS
    PCA主成分分析理解
    SVM理解
    Python调用C++
    Linux opencv安装与编译
  • 原文地址:https://www.cnblogs.com/xkxjy/p/3672256.html
Copyright © 2011-2022 走看看