📄 module-uu.html
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>12.7 uu -- Encode and decode uuencode files</title>
<META NAME="description" CONTENT="12.7 uu -- Encode and decode uuencode files">
<META NAME="keywords" CONTENT="lib">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="STYLESHEET" href="lib.css" tppabs="http://www.python.org/doc/current/lib/lib.css">
<LINK REL="next" href="module-binascii.html" tppabs="http://www.python.org/doc/current/lib/module-binascii.html">
<LINK REL="previous" href="module-binhex.html" tppabs="http://www.python.org/doc/current/lib/module-binhex.html">
<LINK REL="up" href="netdata.html" tppabs="http://www.python.org/doc/current/lib/netdata.html">
<LINK REL="next" href="module-binascii.html" tppabs="http://www.python.org/doc/current/lib/module-binascii.html">
</head>
<body>
<DIV CLASS="navigation"><table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td><A href="binhex-notes.html" tppabs="http://www.python.org/doc/current/lib/binhex-notes.html"><img src="previous.gif" tppabs="http://www.python.org/doc/current/icons/previous.gif" border="0" height="32"
alt="Previous Page" width="32"></A></td>
<td><A href="netdata.html" tppabs="http://www.python.org/doc/current/lib/netdata.html"><img src="up.gif" tppabs="http://www.python.org/doc/current/icons/up.gif" border="0" height="32"
alt="Up One Level" width="32"></A></td>
<td><A href="module-binascii.html" tppabs="http://www.python.org/doc/current/lib/module-binascii.html"><img src="next.gif" tppabs="http://www.python.org/doc/current/icons/next.gif" border="0" height="32"
alt="Next Page" width="32"></A></td>
<td align="center" width="100%">Python Library Reference</td>
<td><A href="contents.html" tppabs="http://www.python.org/doc/current/lib/contents.html"><img src="contents.gif" tppabs="http://www.python.org/doc/current/icons/contents.gif" border="0" height="32"
alt="Contents" width="32"></A></td>
<td><a href="modindex.html" tppabs="http://www.python.org/doc/current/lib/modindex.html" title="Module Index"><img src="modules.gif" tppabs="http://www.python.org/doc/current/icons/modules.gif" border="0" height="32"
alt="Module Index" width="32"></a></td>
<td><A href="genindex.html" tppabs="http://www.python.org/doc/current/lib/genindex.html"><img src="index.gif" tppabs="http://www.python.org/doc/current/icons/index.gif" border="0" height="32"
alt="Index" width="32"></A></td>
</tr></table>
<b class="navlabel">Previous:</b> <a class="sectref" href="binhex-notes.html" tppabs="http://www.python.org/doc/current/lib/binhex-notes.html">12.6.1 Notes</A>
<b class="navlabel">Up:</b> <a class="sectref" href="netdata.html" tppabs="http://www.python.org/doc/current/lib/netdata.html">12. Internet Data Handling</A>
<b class="navlabel">Next:</b> <a class="sectref" href="module-binascii.html" tppabs="http://www.python.org/doc/current/lib/module-binascii.html">12.8 binascii </A>
<br><hr></DIV>
<!--End of Navigation Panel-->
<H1><A NAME="SECTION0014700000000000000000">
12.7 <tt class="module">uu</tt> --
Encode and decode uuencode files</A>
</H1>
<P>
<P>
This module encodes and decodes files in uuencode format, allowing
arbitrary binary data to be transferred over ascii-only connections.
Wherever a file argument is expected, the methods accept a file-like
object. For backwards compatibility, a string containing a pathname
is also accepted, and the corresponding file will be opened for
reading and writing; the pathname <code>'-'</code> is understood to mean the
standard input or output. However, this interface is deprecated; it's
better for the caller to open the file itself, and be sure that, when
required, the mode is <code>'rb'</code> or <code>'wb'</code> on Windows or DOS.
<P>
This code was contributed by Lance Ellinghouse, and modified by Jack
Jansen.
<P>
The <tt class="module">uu</tt> module defines the following functions:
<P>
<dl><dt><b><a name='l2h-2413'><tt class='function'>encode</tt></a></b> (<var>in_file, out_file</var><big>[</big><var>, name</var><big>[</big><var>, mode</var><big>]</big><big>]</big>)
<dd>
Uuencode file <var>in_file</var> into file <var>out_file</var>. The uuencoded
file will have the header specifying <var>name</var> and <var>mode</var> as the
defaults for the results of decoding the file. The default defaults
are taken from <var>in_file</var>, or <code>'-'</code> and <code>0666</code> respectively.
</dl>
<P>
<dl><dt><b><a name='l2h-2414'><tt class='function'>decode</tt></a></b> (<var>in_file</var><big>[</big><var>, out_file</var><big>[</big><var>, mode</var><big>]</big><big>]</big>)
<dd>
This call decodes uuencoded file <var>in_file</var> placing the result on
file <var>out_file</var>. If <var>out_file</var> is a pathname, <var>mode</var> is
used to set the permission bits if the file must be created. Defaults
for <var>out_file</var> and <var>mode</var> are taken from the uuencode header.
</dl>
<P>
<div class='seealso'>
<p class='heading'><b>See Also:</b></p>
<dl compact class="seemodule">
<dt>Module <b><tt class='module'><a href="module-binascii.html" tppabs="http://www.python.org/doc/current/lib/module-binascii.html">binascii</a></tt>:</b>
<dd>support module containing ASCII-to-binary
and binary-to-ASCII conversions.
</dl>
</div>
<DIV CLASS="navigation"><p><hr><table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td><A href="binhex-notes.html" tppabs="http://www.python.org/doc/current/lib/binhex-notes.html"><img src="previous.gif" tppabs="http://www.python.org/doc/current/icons/previous.gif" border="0" height="32"
alt="Previous Page" width="32"></A></td>
<td><A href="netdata.html" tppabs="http://www.python.org/doc/current/lib/netdata.html"><img src="up.gif" tppabs="http://www.python.org/doc/current/icons/up.gif" border="0" height="32"
alt="Up One Level" width="32"></A></td>
<td><A href="module-binascii.html" tppabs="http://www.python.org/doc/current/lib/module-binascii.html"><img src="next.gif" tppabs="http://www.python.org/doc/current/icons/next.gif" border="0" height="32"
alt="Next Page" width="32"></A></td>
<td align="center" width="100%">Python Library Reference</td>
<td><A href="contents.html" tppabs="http://www.python.org/doc/current/lib/contents.html"><img src="contents.gif" tppabs="http://www.python.org/doc/current/icons/contents.gif" border="0" height="32"
alt="Contents" width="32"></A></td>
<td><a href="modindex.html" tppabs="http://www.python.org/doc/current/lib/modindex.html" title="Module Index"><img src="modules.gif" tppabs="http://www.python.org/doc/current/icons/modules.gif" border="0" height="32"
alt="Module Index" width="32"></a></td>
<td><A href="genindex.html" tppabs="http://www.python.org/doc/current/lib/genindex.html"><img src="index.gif" tppabs="http://www.python.org/doc/current/icons/index.gif" border="0" height="32"
alt="Index" width="32"></A></td>
</tr></table>
<b class="navlabel">Previous:</b> <a class="sectref" href="binhex-notes.html" tppabs="http://www.python.org/doc/current/lib/binhex-notes.html">12.6.1 Notes</A>
<b class="navlabel">Up:</b> <a class="sectref" href="netdata.html" tppabs="http://www.python.org/doc/current/lib/netdata.html">12. Internet Data Handling</A>
<b class="navlabel">Next:</b> <a class="sectref" href="module-binascii.html" tppabs="http://www.python.org/doc/current/lib/module-binascii.html">12.8 binascii </A>
</DIV>
<!--End of Navigation Panel-->
<ADDRESS>
<hr>See <i><a href="about.html" tppabs="http://www.python.org/doc/current/lib/about.html">About this document...</a></i> for information on suggesting changes.
</ADDRESS>
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -