diff -r 8d802f93a55a Doc/library/zipfile.rst --- a/Doc/library/zipfile.rst Sat May 14 06:17:43 2016 +0000 +++ b/Doc/library/zipfile.rst Sat May 14 23:01:27 2016 +0100 @@ -207,7 +207,7 @@ .. index:: single: universal newlines; zipfile.ZipFile.open method -.. method:: ZipFile.open(name, mode='r', pwd=None, force_zip64=False) +.. method:: ZipFile.open(name, mode='r', pwd=None, *, force_zip64=False) Access a member of the archive as a file-like object. *name* is the name of the file in the archive, or a :class:`ZipInfo` object. The @@ -490,7 +490,13 @@ .. versionadded:: 3.6 -Instances have the following attributes: +Instances have the following methods and attributes: + +.. method:: ZipInfo.is_dir() + + Return True if this archive member is a directory. + + .. versionadded:: 3.6 .. attribute:: ZipInfo.filename diff -r 8d802f93a55a Lib/zipfile.py --- a/Lib/zipfile.py Sat May 14 06:17:43 2016 +0000 +++ b/Lib/zipfile.py Sat May 14 23:01:27 2016 +0100 @@ -502,6 +502,10 @@ return zinfo def is_dir(self): + """Return True if this ZipInfo represents a directory inthe zip file + + This uses the entry's name: directories should always end with / + """ return self.filename[-1] == '/' @@ -1343,7 +1347,7 @@ with self.open(name, "r", pwd) as fp: return fp.read() - def open(self, name, mode="r", pwd=None, force_zip64=False): + def open(self, name, mode="r", pwd=None, *, force_zip64=False): """Return file-like object for 'name'. name is a string for the file name within the ZIP file, or a ZipInfo