Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
e6f4d808
Commit
e6f4d808
authored
Mar 06, 2007
by
Martin v. Löwis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Patch #1121142: Implement ZipFile.open.
parent
e01b50d2
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
665 additions
and
49 deletions
+665
-49
Doc/lib/libzipfile.tex
Doc/lib/libzipfile.tex
+26
-0
Lib/test/test_zipfile.py
Lib/test/test_zipfile.py
+402
-10
Lib/zipfile.py
Lib/zipfile.py
+235
-39
Misc/NEWS
Misc/NEWS
+2
-0
No files found.
Doc/lib/libzipfile.tex
View file @
e6f4d808
...
...
@@ -141,6 +141,32 @@ cat myzip.zip >> python.exe
Return a list of archive members by name.
\end{methoddesc}
\begin{methoddesc}
{
open
}{
name
\optional
{
, mode
\optional
{
, pwd
}}}
Extract a member from the archive as a file-like object (ZipExtFile).
\var
{
name
}
is the name of the file in the archive. The
\var
{
mode
}
parameter, if included, must be one of the following:
\code
{
'r'
}
(the
default),
\code
{
'U'
}
, or
\code
{
'rU'
}
. Choosing
\code
{
'U'
}
or
\code
{
'rU'
}
will enable universal newline support in the read-only
object.
\var
{
pwd
}
is the password used for encrypted files.
\begin{notice}
The file-like object is read-only and provides the following methods:
\method
{
read()
}
,
\method
{
readline()
}
,
\method
{
readlines()
}
,
\method
{__
iter
__
()
}
,
\method
{
next()
}
.
\end{notice}
\begin{notice}
If the ZipFile was created by passing in a file-like object as the
first argument to the constructor, then the object returned by
\method
{
open()
}
shares the ZipFile's file pointer. Under these
circumstances, the object returned by
\method
{
open()
}
should not
be used after any additional operations are performed on the
ZipFile object. If the ZipFile was created by passing in a string
(the filename) as the first argument to the constructor, then
\method
{
open()
}
will create a new file object that will be held
by the ZipExtFile, allowing it to operate independently of the
ZipFile.
\end{notice}
\end{methoddesc}
\begin{methoddesc}
{
printdir
}{}
Print a table of contents for the archive to
\code
{
sys.stdout
}
.
\end{methoddesc}
...
...
Lib/test/test_zipfile.py
View file @
e6f4d808
This diff is collapsed.
Click to expand it.
Lib/zipfile.py
View file @
e6f4d808
This diff is collapsed.
Click to expand it.
Misc/NEWS
View file @
e6f4d808
...
...
@@ -139,6 +139,8 @@ Core and builtins
Library
-------
- Patch #1121142: Implement ZipFile.open.
- Taught setup.py how to locate Berkeley DB on Macs using MacPorts.
- Added heapq.merge() for merging sorted input streams.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment