⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 module-mimetools.html

📁 一本很好的python的说明书,适合对python感兴趣的人
💻 HTML
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>12.3 mimetools -- Tools for parsing MIME messages</title>
<META NAME="description" CONTENT="12.3 mimetools -- Tools for parsing MIME messages">
<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-MimeWriter.html" tppabs="http://www.python.org/doc/current/lib/module-MimeWriter.html">
<LINK REL="previous" href="module-rfc822.html" tppabs="http://www.python.org/doc/current/lib/module-rfc822.html">
<LINK REL="up" href="netdata.html" tppabs="http://www.python.org/doc/current/lib/netdata.html">
<LINK REL="next" href="mimetools-message-objects.html" tppabs="http://www.python.org/doc/current/lib/mimetools-message-objects.html">
</head>
<body>
<DIV CLASS="navigation"><table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td><A href="addresslist-objects.html" tppabs="http://www.python.org/doc/current/lib/addresslist-objects.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="mimetools-message-objects.html" tppabs="http://www.python.org/doc/current/lib/mimetools-message-objects.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="addresslist-objects.html" tppabs="http://www.python.org/doc/current/lib/addresslist-objects.html">12.2.2 AddressList Objects</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="mimetools-message-objects.html" tppabs="http://www.python.org/doc/current/lib/mimetools-message-objects.html">12.3.1 Additional Methods of</A>
<br><hr></DIV>
<!--End of Navigation Panel-->

<H1><A NAME="SECTION0014300000000000000000">
12.3 <tt class="module">mimetools</tt> --
         Tools for parsing MIME messages</A>
</H1>

<P>


<P>
This module defines a subclass of the
<tt class='module'><a href="module-rfc822.html" tppabs="http://www.python.org/doc/current/lib/module-rfc822.html">rfc822</a></tt> module's
<tt class="class">Message</tt> class and a number of utility functions that are
useful for the manipulation for MIME multipart or encoded message.

<P>
It defines the following items:

<P>
<dl><dt><b><a name='l2h-2373'><tt class='class'>Message</tt></a></b> (<var>fp</var><big>[</big><var>, seekable</var><big>]</big>)
<dd>
Return a new instance of the <tt class="class">Message</tt> class.  This is a
subclass of the <tt class="class">rfc822.Message</tt> class, with some additional
methods (see below).  The <var>seekable</var> argument has the same meaning
as for <tt class="class">rfc822.Message</tt>.
</dl>

<P>
<dl><dt><b><a name='l2h-2374'><tt class='function'>choose_boundary</tt></a></b> ()
<dd>
Return a unique string that has a high likelihood of being usable as a
part boundary.  The string has the form
<code>'<var>hostipaddr</var>.<var>uid</var>.<var>pid</var>.<var>timestamp</var>.<var>random</var>'</code>.
</dl>

<P>
<dl><dt><b><a name='l2h-2375'><tt class='function'>decode</tt></a></b> (<var>input, output, encoding</var>)
<dd>
Read data encoded using the allowed MIME <var>encoding</var> from open file
object <var>input</var> and write the decoded data to open file object
<var>output</var>.  Valid values for <var>encoding</var> include
<code>'base64'</code>, <code>'quoted-printable'</code> and <code>'uuencode'</code>.
</dl>

<P>
<dl><dt><b><a name='l2h-2376'><tt class='function'>encode</tt></a></b> (<var>input, output, encoding</var>)
<dd>
Read data from open file object <var>input</var> and write it encoded using
the allowed MIME <var>encoding</var> to open file object <var>output</var>.
Valid values for <var>encoding</var> are the same as for <tt class="method">decode()</tt>.
</dl>

<P>
<dl><dt><b><a name='l2h-2377'><tt class='function'>copyliteral</tt></a></b> (<var>input, output</var>)
<dd>
Read lines from open file <var>input</var> until EOF and write them to
open file <var>output</var>.
</dl>

<P>
<dl><dt><b><a name='l2h-2378'><tt class='function'>copybinary</tt></a></b> (<var>input, output</var>)
<dd>
Read blocks until EOF from open file <var>input</var> and write them to
open file <var>output</var>.  The block size is currently fixed at 8192.
</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-rfc822.html" tppabs="http://www.python.org/doc/current/lib/module-rfc822.html">rfc822</a></tt>:</b>
    <dd>Provides the base class for
                     <tt class="class">mimetools.Message</tt>.
  </dl>
  <dl compact class="seemodule">
    <dt>Module <b><tt class='module'><a href="module-multifile.html" tppabs="http://www.python.org/doc/current/lib/module-multifile.html">multifile</a></tt>:</b>
    <dd>Support for reading files which contain
                        distinct parts, such as MIME data.
  </dl>
  <dl compact class="seeurl">
    <dt><a href="javascript:if(confirm('http://www.cs.uu.nl/wais/html/na-dir/mail/mime-faq/.html  \n\nThis file was not retrieved by Teleport Pro, because it is addressed on a domain or path outside the boundaries set for its Starting Address.  \n\nDo you want to open it from the server?'))window.location='http://www.cs.uu.nl/wais/html/na-dir/mail/mime-faq/.html'" tppabs="http://www.cs.uu.nl/wais/html/na-dir/mail/mime-faq/.html"
        class="url">http://www.cs.uu.nl/wais/html/na-dir/mail/mime-faq/.html <img src="offsite.gif" tppabs="http://www.python.org/doc/current/icons/offsite.gif"
  border='0' class='offsitelink' height='15' width='17' alt='[off-site link]'
  ></a>
    <dd>
          The MIME Frequently Asked Questions document.  For an
          overview of MIME, see the answer to question 1.1 in Part 1
          of this document.
  </dl>
</div>

<P>

<p><hr>
<!--Table of Child-Links-->
<A NAME="CHILD_LINKS"><STRONG>Subsections</STRONG></A>

<UL>
<LI><A NAME="tex2html4422"
  href="mimetools-message-objects.html" tppabs="http://www.python.org/doc/current/lib/mimetools-message-objects.html">12.3.1 Additional Methods of Message Objects
            </A>
</UL>
<!--End of Table of Child-Links-->

<DIV CLASS="navigation"><p><hr><table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td><A href="addresslist-objects.html" tppabs="http://www.python.org/doc/current/lib/addresslist-objects.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="mimetools-message-objects.html" tppabs="http://www.python.org/doc/current/lib/mimetools-message-objects.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="addresslist-objects.html" tppabs="http://www.python.org/doc/current/lib/addresslist-objects.html">12.2.2 AddressList Objects</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="mimetools-message-objects.html" tppabs="http://www.python.org/doc/current/lib/mimetools-message-objects.html">12.3.1 Additional Methods of</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 + -