合规国际互联网加速 OSASE为企业客户提供高速稳定SD-WAN国际加速解决方案。 广告
### 导航 - [索引](../genindex.xhtml "总目录") - [模块](../py-modindex.xhtml "Python 模块索引") | - [下一页](markup.xhtml "结构化标记处理工具") | - [上一页](quopri.xhtml "quopri --- Encode and decode MIME quoted-printable data") | - ![](https://box.kancloud.cn/a721fc7ec672275e257bbbfde49a4d4e_16x16.png) - [Python](https://www.python.org/) » - zh\_CN 3.7.3 [文档](../index.xhtml) » - [Python 标准库](index.xhtml) » - [互联网数据处理](netdata.xhtml) » - $('.inline-search').show(0); | # [`uu`](#module-uu "uu: Encode and decode files in uuencode format.") --- Encode and decode uuencode files **Source code:** [Lib/uu.py](https://github.com/python/cpython/tree/3.7/Lib/uu.py) \[https://github.com/python/cpython/tree/3.7/Lib/uu.py\] - - - - - - 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 `'-'`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 `'rb'` or `'wb'` on Windows. This code was contributed by Lance Ellinghouse, and modified by Jack Jansen. The [`uu`](#module-uu "uu: Encode and decode files in uuencode format.") module defines the following functions: `uu.``encode`(*in\_file*, *out\_file*, *name=None*, *mode=None*, *\**, *backtick=False*)Uuencode file *in\_file* into file *out\_file*. The uuencoded file will have the header specifying *name* and *mode* as the defaults for the results of decoding the file. The default defaults are taken from *in\_file*, or `'-'`and `0o666` respectively. If *backtick* is true, zeros are represented by `'`'` instead of spaces. 在 3.7 版更改: 增加 *backtick* 参数 `uu.``decode`(*in\_file*, *out\_file=None*, *mode=None*, *quiet=False*)This call decodes uuencoded file *in\_file* placing the result on file *out\_file*. If *out\_file* is a pathname, *mode* is used to set the permission bits if the file must be created. Defaults for *out\_file* and *mode* are taken from the uuencode header. However, if the file specified in the header already exists, a [`uu.Error`](#uu.Error "uu.Error") is raised. [`decode()`](#uu.decode "uu.decode") may print a warning to standard error if the input was produced by an incorrect uuencoder and Python could recover from that error. Setting *quiet* to a true value silences this warning. *exception* `uu.``Error`Subclass of [`Exception`](exceptions.xhtml#Exception "Exception"), this can be raised by [`uu.decode()`](#uu.decode "uu.decode") under various situations, such as described above, but also including a badly formatted header, or truncated input file. 参见 模块 [`binascii`](binascii.xhtml#module-binascii "binascii: Tools for converting between binary and various ASCII-encoded binary representations.")支持模块,包含ASCII到二进制和二进制到ASCII转换。 ### 导航 - [索引](../genindex.xhtml "总目录") - [模块](../py-modindex.xhtml "Python 模块索引") | - [下一页](markup.xhtml "结构化标记处理工具") | - [上一页](quopri.xhtml "quopri --- Encode and decode MIME quoted-printable data") | - ![](https://box.kancloud.cn/a721fc7ec672275e257bbbfde49a4d4e_16x16.png) - [Python](https://www.python.org/) » - zh\_CN 3.7.3 [文档](../index.xhtml) » - [Python 标准库](index.xhtml) » - [互联网数据处理](netdata.xhtml) » - $('.inline-search').show(0); | © [版权所有](../copyright.xhtml) 2001-2019, Python Software Foundation. Python 软件基金会是一个非盈利组织。 [请捐助。](https://www.python.org/psf/donations/) 最后更新于 5月 21, 2019. [发现了问题](../bugs.xhtml)? 使用[Sphinx](http://sphinx.pocoo.org/)1.8.4 创建。