當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。