当前位置: 首页>>代码示例>>Python>>正文


Python zipfile.getinfo方法代码示例

本文整理汇总了Python中zipfile.getinfo方法的典型用法代码示例。如果您正苦于以下问题:Python zipfile.getinfo方法的具体用法?Python zipfile.getinfo怎么用?Python zipfile.getinfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在模块zipfile的用法示例。

在下文中一共展示了zipfile.getinfo方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: PKzipSearch

# 需要导入模块: import zipfile [as 别名]
# 或者: from zipfile import getinfo [as 别名]
def PKzipSearch(self, InvTABLEname, SQL, LOG, DLDir, savefile):
        try:
            # print(zipfile.getinfo(savefile))
            if zipfile.is_zipfile(savefile):
                file = zipfile.ZipFile(savefile, "r")
                extracted_emails = []
                for name in file.namelist():
                    if re.findall("php$", name):
                        scam_email2 = re.findall(r'[\w\.-]+@[\w\.-]+\.\w+', str(file.read(name)))
                        for mailadd in scam_email2:
                            if mailadd not in extracted_emails:
                                extracted_emails.append(mailadd)
                # Extracted scammers email
                if any(map(len, extracted_emails)):
                    return [extracted_emails]
                else:
                    LOG.info("No emails in this kit? Uglyyyyy ô0")
                    pass
            else:
                LOG.info("{} is not a zip file...".format(savefile))
        except Exception as e:
            print("[!!!] Problem with PKzipSearch Class: " + str(e)) 
开发者ID:t4d,项目名称:StalkPhish,代码行数:24,代码来源:utils.py


示例2: __init__

# 需要导入模块: import zipfile [as 别名]
# 或者: from zipfile import getinfo [as 别名]
def __init__(self, zipfile, entry=''):
        """
        Create a new path pointer pointing at the specified entry
        in the given zipfile.

        :raise IOError: If the given zipfile does not exist, or if it
        does not contain the specified entry.
        """
        if isinstance(zipfile, string_types):
            zipfile = OpenOnDemandZipFile(os.path.abspath(zipfile))

        # Normalize the entry string, it should be relative:
        entry = normalize_resource_name(entry, True, '/').lstrip('/')

        # Check that the entry exists:
        if entry:
            try:
                zipfile.getinfo(entry)
            except Exception:
                # Sometimes directories aren't explicitly listed in
                # the zip file.  So if `entry` is a directory name,
                # then check if the zipfile contains any files that
                # are under the given directory.
                if (entry.endswith('/') and
                        [n for n in zipfile.namelist() if n.startswith(entry)]):
                    pass  # zipfile contains a file in that directory.
                else:
                    # Otherwise, complain.
                    raise IOError('Zipfile %r does not contain %r' %
                                  (zipfile.filename, entry))
        self._zipfile = zipfile
        self._entry = entry 
开发者ID:rafasashi,项目名称:razzy-spinner,代码行数:34,代码来源:data.py


示例3: file_size

# 需要导入模块: import zipfile [as 别名]
# 或者: from zipfile import getinfo [as 别名]
def file_size(self):
        return self._zipfile.getinfo(self._entry).file_size 
开发者ID:rafasashi,项目名称:razzy-spinner,代码行数:4,代码来源:data.py


示例4: __init__

# 需要导入模块: import zipfile [as 别名]
# 或者: from zipfile import getinfo [as 别名]
def __init__(self, zipfile, name):
			info = zipfile.getinfo(name)
			for x in dir(info):
				if not (x.startswith("_") or x.endswith("_")):
					setattr(self, x, getattr(info, x))
			self.size = self.file_size 
开发者ID:kozec,项目名称:syncthing-gtk,代码行数:8,代码来源:stdownloader.py


示例5: __init__

# 需要导入模块: import zipfile [as 别名]
# 或者: from zipfile import getinfo [as 别名]
def __init__(self, zipfile, entry=''):
        """
        Create a new path pointer pointing at the specified entry
        in the given zipfile.

        :raise IOError: If the given zipfile does not exist, or if it
        does not contain the specified entry.
        """
        if isinstance(zipfile, basestring):
            zipfile = OpenOnDemandZipFile(os.path.abspath(zipfile))

        # Normalize the entry string:
        entry = re.sub('(^|/)/+', r'\1', entry)

        # Check that the entry exists:
        if entry:
            try: zipfile.getinfo(entry)
            except:
                # Sometimes directories aren't explicitly listed in
                # the zip file.  So if `entry` is a directory name,
                # then check if the zipfile contains any files that
                # are under the given directory.
                if (entry.endswith('/') and
                    [n for n in zipfile.namelist() if n.startswith(entry)]):
                    pass # zipfile contains a file in that directory.
                else:
                    # Otherwise, complain.
                    raise IOError('Zipfile %r does not contain %r' %
                                  (zipfile.filename, entry))
        self._zipfile = zipfile
        self._entry = entry 
开发者ID:blackye,项目名称:luscan-devel,代码行数:33,代码来源:data.py


示例6: __init__

# 需要导入模块: import zipfile [as 别名]
# 或者: from zipfile import getinfo [as 别名]
def __init__(self, zipfile, entry=''):
        """
        Create a new path pointer pointing at the specified entry
        in the given zipfile.

        :raise IOError: If the given zipfile does not exist, or if it
        does not contain the specified entry.
        """
        if isinstance(zipfile, string_types):
            zipfile = OpenOnDemandZipFile(os.path.abspath(zipfile))

        # Check that the entry exists:
        if entry:

            # Normalize the entry string, it should be relative:
            entry = normalize_resource_name(entry, True, '/').lstrip('/')

            try:
                zipfile.getinfo(entry)
            except Exception:
                # Sometimes directories aren't explicitly listed in
                # the zip file.  So if `entry` is a directory name,
                # then check if the zipfile contains any files that
                # are under the given directory.
                if entry.endswith('/') and [
                    n for n in zipfile.namelist() if n.startswith(entry)
                ]:
                    pass  # zipfile contains a file in that directory.
                else:
                    # Otherwise, complain.
                    raise IOError(
                        'Zipfile %r does not contain %r' % (zipfile.filename, entry)
                    )
        self._zipfile = zipfile
        self._entry = entry 
开发者ID:V1EngineeringInc,项目名称:V1EngineeringInc-Docs,代码行数:37,代码来源:data.py



注:本文中的zipfile.getinfo方法示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。