Commit | Line | Data |
---|---|---|
920dae64 AT |
1 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
2 | <html> | |
3 | <head> | |
4 | <link rel="STYLESHEET" href="lib.css" type='text/css' /> | |
5 | <link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" /> | |
6 | <link rel='start' href='../index.html' title='Python Documentation Index' /> | |
7 | <link rel="first" href="lib.html" title='Python Library Reference' /> | |
8 | <link rel='contents' href='contents.html' title="Contents" /> | |
9 | <link rel='index' href='genindex.html' title='Index' /> | |
10 | <link rel='last' href='about.html' title='About this document...' /> | |
11 | <link rel='help' href='about.html' title='About this document...' /> | |
12 | <link rel="next" href="zipinfo-objects.html" /> | |
13 | <link rel="prev" href="zipfile-objects.html" /> | |
14 | <link rel="parent" href="module-zipfile.html" /> | |
15 | <link rel="next" href="zipinfo-objects.html" /> | |
16 | <meta name='aesop' content='information' /> | |
17 | <title>7.18.2 PyZipFile Objects </title> | |
18 | </head> | |
19 | <body> | |
20 | <DIV CLASS="navigation"> | |
21 | <div id='top-navigation-panel' xml:id='top-navigation-panel'> | |
22 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> | |
23 | <tr> | |
24 | <td class='online-navigation'><a rel="prev" title="7.18.1 ZipFile Objects" | |
25 | href="zipfile-objects.html"><img src='../icons/previous.png' | |
26 | border='0' height='32' alt='Previous Page' width='32' /></A></td> | |
27 | <td class='online-navigation'><a rel="parent" title="7.18 zipfile " | |
28 | href="module-zipfile.html"><img src='../icons/up.png' | |
29 | border='0' height='32' alt='Up One Level' width='32' /></A></td> | |
30 | <td class='online-navigation'><a rel="next" title="7.18.3 ZipInfo Objects" | |
31 | href="zipinfo-objects.html"><img src='../icons/next.png' | |
32 | border='0' height='32' alt='Next Page' width='32' /></A></td> | |
33 | <td align="center" width="100%">Python Library Reference</td> | |
34 | <td class='online-navigation'><a rel="contents" title="Table of Contents" | |
35 | href="contents.html"><img src='../icons/contents.png' | |
36 | border='0' height='32' alt='Contents' width='32' /></A></td> | |
37 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' | |
38 | border='0' height='32' alt='Module Index' width='32' /></a></td> | |
39 | <td class='online-navigation'><a rel="index" title="Index" | |
40 | href="genindex.html"><img src='../icons/index.png' | |
41 | border='0' height='32' alt='Index' width='32' /></A></td> | |
42 | </tr></table> | |
43 | <div class='online-navigation'> | |
44 | <b class="navlabel">Previous:</b> | |
45 | <a class="sectref" rel="prev" href="zipfile-objects.html">7.18.1 ZipFile Objects</A> | |
46 | <b class="navlabel">Up:</b> | |
47 | <a class="sectref" rel="parent" href="module-zipfile.html">7.18 zipfile </A> | |
48 | <b class="navlabel">Next:</b> | |
49 | <a class="sectref" rel="next" href="zipinfo-objects.html">7.18.3 ZipInfo Objects</A> | |
50 | </div> | |
51 | <hr /></div> | |
52 | </DIV> | |
53 | <!--End of Navigation Panel--> | |
54 | ||
55 | <H2><A NAME="SECTION0091820000000000000000"></A><A NAME="pyzipfile-objects"></A> | |
56 | <BR> | |
57 | 7.18.2 PyZipFile Objects | |
58 | </H2> | |
59 | ||
60 | <P> | |
61 | The <tt class="class">PyZipFile</tt> constructor takes the same parameters as the | |
62 | <tt class="class">ZipFile</tt> constructor. Instances have one method in addition to | |
63 | those of <tt class="class">ZipFile</tt> objects. | |
64 | ||
65 | <P> | |
66 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
67 | <td><nobr><b><tt id='l2h-2869' xml:id='l2h-2869' class="method">writepy</tt></b>(</nobr></td> | |
68 | <td><var>pathname</var><big>[</big><var>, basename</var><big>]</big><var></var>)</td></tr></table></dt> | |
69 | <dd> | |
70 | Search for files <span class="file">*.py</span> and add the corresponding file to the | |
71 | archive. The corresponding file is a <span class="file">*.pyo</span> file if | |
72 | available, else a <span class="file">*.pyc</span> file, compiling if necessary. If the | |
73 | pathname is a file, the filename must end with <span class="file">.py</span>, and just | |
74 | the (corresponding <span class="file">*.py[co]</span>) file is added at the top level | |
75 | (no path information). If it is a directory, and the directory is | |
76 | not a package directory, then all the files <span class="file">*.py[co]</span> are | |
77 | added at the top level. If the directory is a package directory, | |
78 | then all <span class="file">*.py[oc]</span> are added under the package name as a file | |
79 | path, and if any subdirectories are package directories, all of | |
80 | these are added recursively. <var>basename</var> is intended for | |
81 | internal use only. The <tt class="method">writepy()</tt> method makes archives | |
82 | with file names like this: | |
83 | ||
84 | <P> | |
85 | <div class="verbatim"><pre> | |
86 | string.pyc # Top level name | |
87 | test/__init__.pyc # Package directory | |
88 | test/testall.pyc # Module test.testall | |
89 | test/bogus/__init__.pyc # Subpackage directory | |
90 | test/bogus/myfile.pyc # Submodule test.bogus.myfile | |
91 | </pre></div> | |
92 | </dl> | |
93 | ||
94 | <P> | |
95 | ||
96 | <DIV CLASS="navigation"> | |
97 | <div class='online-navigation'> | |
98 | <p></p><hr /> | |
99 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> | |
100 | <tr> | |
101 | <td class='online-navigation'><a rel="prev" title="7.18.1 ZipFile Objects" | |
102 | href="zipfile-objects.html"><img src='../icons/previous.png' | |
103 | border='0' height='32' alt='Previous Page' width='32' /></A></td> | |
104 | <td class='online-navigation'><a rel="parent" title="7.18 zipfile " | |
105 | href="module-zipfile.html"><img src='../icons/up.png' | |
106 | border='0' height='32' alt='Up One Level' width='32' /></A></td> | |
107 | <td class='online-navigation'><a rel="next" title="7.18.3 ZipInfo Objects" | |
108 | href="zipinfo-objects.html"><img src='../icons/next.png' | |
109 | border='0' height='32' alt='Next Page' width='32' /></A></td> | |
110 | <td align="center" width="100%">Python Library Reference</td> | |
111 | <td class='online-navigation'><a rel="contents" title="Table of Contents" | |
112 | href="contents.html"><img src='../icons/contents.png' | |
113 | border='0' height='32' alt='Contents' width='32' /></A></td> | |
114 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' | |
115 | border='0' height='32' alt='Module Index' width='32' /></a></td> | |
116 | <td class='online-navigation'><a rel="index" title="Index" | |
117 | href="genindex.html"><img src='../icons/index.png' | |
118 | border='0' height='32' alt='Index' width='32' /></A></td> | |
119 | </tr></table> | |
120 | <div class='online-navigation'> | |
121 | <b class="navlabel">Previous:</b> | |
122 | <a class="sectref" rel="prev" href="zipfile-objects.html">7.18.1 ZipFile Objects</A> | |
123 | <b class="navlabel">Up:</b> | |
124 | <a class="sectref" rel="parent" href="module-zipfile.html">7.18 zipfile </A> | |
125 | <b class="navlabel">Next:</b> | |
126 | <a class="sectref" rel="next" href="zipinfo-objects.html">7.18.3 ZipInfo Objects</A> | |
127 | </div> | |
128 | </div> | |
129 | <hr /> | |
130 | <span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span> | |
131 | </DIV> | |
132 | <!--End of Navigation Panel--> | |
133 | <ADDRESS> | |
134 | See <i><a href="about.html">About this document...</a></i> for information on suggesting changes. | |
135 | </ADDRESS> | |
136 | </BODY> | |
137 | </HTML> |