[ SEA-GHOST MINI SHELL]

Path : /proc/2/cwd/proc/2/root/usr/share/doc/python-docs-2.7.5/html/library/
FILE UPLOADER :
Current File : //proc/2/cwd/proc/2/root/usr/share/doc/python-docs-2.7.5/html/library/email.iterators.html


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>18.1.10. email.iterators: Iterators &mdash; Python 2.7.5 documentation</title>
    
    <link rel="stylesheet" href="../_static/default.css" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
    
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '../',
        VERSION:     '2.7.5',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="../_static/jquery.js"></script>
    <script type="text/javascript" src="../_static/underscore.js"></script>
    <script type="text/javascript" src="../_static/doctools.js"></script>
    <script type="text/javascript" src="../_static/sidebar.js"></script>
    <link rel="search" type="application/opensearchdescription+xml"
          title="Search within Python 2.7.5 documentation"
          href="../_static/opensearch.xml"/>
    <link rel="author" title="About these documents" href="../about.html" />
    <link rel="copyright" title="Copyright" href="../copyright.html" />
    <link rel="top" title="Python 2.7.5 documentation" href="../index.html" />
    <link rel="up" title="18.1. email — An email and MIME handling package" href="email.html" />
    <link rel="next" title="18.1.11. email: Examples" href="email-examples.html" />
    <link rel="prev" title="18.1.9. email.utils: Miscellaneous utilities" href="email.util.html" />
    <link rel="shortcut icon" type="image/png" href="../_static/py.png" />
    <script type="text/javascript" src="../_static/copybutton.js"></script>
    
 

  </head>
  <body>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="email-examples.html" title="18.1.11. email: Examples"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="email.util.html" title="18.1.9. email.utils: Miscellaneous utilities"
             accesskey="P">previous</a> |</li>
        <li><img src="../_static/py.png" alt=""
                 style="vertical-align: middle; margin-top: -1px"/></li>
        <li><a href="http://www.python.org/">Python</a> &raquo;</li>
        <li>
          <a href="../index.html">Python 2.7.5 documentation</a> &raquo;
        </li>

          <li><a href="index.html" >The Python Standard Library</a> &raquo;</li>
          <li><a href="netdata.html" >18. Internet Data Handling</a> &raquo;</li>
          <li><a href="email.html" accesskey="U">18.1. <tt class="docutils literal"><span class="pre">email</span></tt> &#8212; An email and MIME handling package</a> &raquo;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="module-email.iterators">
<span id="email-iterators-iterators"></span><h1>18.1.10. <a class="reference internal" href="#module-email.iterators" title="email.iterators: Iterate over a  message object tree."><tt class="xref py py-mod docutils literal"><span class="pre">email.iterators</span></tt></a>: Iterators<a class="headerlink" href="#module-email.iterators" title="Permalink to this headline">¶</a></h1>
<p>Iterating over a message object tree is fairly easy with the
<tt class="xref py py-meth docutils literal"><span class="pre">Message.walk()</span></tt> method.  The <a class="reference internal" href="#module-email.iterators" title="email.iterators: Iterate over a  message object tree."><tt class="xref py py-mod docutils literal"><span class="pre">email.iterators</span></tt></a> module provides some
useful higher level iterations over message object trees.</p>
<dl class="function">
<dt id="email.iterators.body_line_iterator">
<tt class="descclassname">email.iterators.</tt><tt class="descname">body_line_iterator</tt><big>(</big><em>msg</em><span class="optional">[</span>, <em>decode</em><span class="optional">]</span><big>)</big><a class="headerlink" href="#email.iterators.body_line_iterator" title="Permalink to this definition">¶</a></dt>
<dd><p>This iterates over all the payloads in all the subparts of <em>msg</em>, returning the
string payloads line-by-line.  It skips over all the subpart headers, and it
skips over any subpart with a payload that isn&#8217;t a Python string.  This is
somewhat equivalent to reading the flat text representation of the message from
a file using <a class="reference internal" href="readline.html#module-readline" title="readline: GNU readline support for Python. (Unix)"><tt class="xref py py-meth docutils literal"><span class="pre">readline()</span></tt></a>, skipping over all the intervening headers.</p>
<p>Optional <em>decode</em> is passed through to <tt class="xref py py-meth docutils literal"><span class="pre">Message.get_payload()</span></tt>.</p>
</dd></dl>

<dl class="function">
<dt id="email.iterators.typed_subpart_iterator">
<tt class="descclassname">email.iterators.</tt><tt class="descname">typed_subpart_iterator</tt><big>(</big><em>msg</em><span class="optional">[</span>, <em>maintype</em><span class="optional">[</span>, <em>subtype</em><span class="optional">]</span><span class="optional">]</span><big>)</big><a class="headerlink" href="#email.iterators.typed_subpart_iterator" title="Permalink to this definition">¶</a></dt>
<dd><p>This iterates over all the subparts of <em>msg</em>, returning only those subparts that
match the MIME type specified by <em>maintype</em> and <em>subtype</em>.</p>
<p>Note that <em>subtype</em> is optional; if omitted, then subpart MIME type matching is
done only with the main type.  <em>maintype</em> is optional too; it defaults to
<em class="mimetype">text</em>.</p>
<p>Thus, by default <a class="reference internal" href="#email.iterators.typed_subpart_iterator" title="email.iterators.typed_subpart_iterator"><tt class="xref py py-func docutils literal"><span class="pre">typed_subpart_iterator()</span></tt></a> returns each subpart that has a
MIME type of <em class="mimetype">text/*</em>.</p>
</dd></dl>

<p>The following function has been added as a useful debugging tool.  It should
<em>not</em> be considered part of the supported public interface for the package.</p>
<dl class="function">
<dt id="email.iterators._structure">
<tt class="descclassname">email.iterators.</tt><tt class="descname">_structure</tt><big>(</big><em>msg</em><span class="optional">[</span>, <em>fp</em><span class="optional">[</span>, <em>level</em><span class="optional">]</span><span class="optional">]</span><big>)</big><a class="headerlink" href="#email.iterators._structure" title="Permalink to this definition">¶</a></dt>
<dd><p>Prints an indented representation of the content types of the message object
structure.  For example:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">msg</span> <span class="o">=</span> <span class="n">email</span><span class="o">.</span><span class="n">message_from_file</span><span class="p">(</span><span class="n">somefile</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">_structure</span><span class="p">(</span><span class="n">msg</span><span class="p">)</span>
<span class="go">multipart/mixed</span>
<span class="go">    text/plain</span>
<span class="go">    text/plain</span>
<span class="go">    multipart/digest</span>
<span class="go">        message/rfc822</span>
<span class="go">            text/plain</span>
<span class="go">        message/rfc822</span>
<span class="go">            text/plain</span>
<span class="go">        message/rfc822</span>
<span class="go">            text/plain</span>
<span class="go">        message/rfc822</span>
<span class="go">            text/plain</span>
<span class="go">        message/rfc822</span>
<span class="go">            text/plain</span>
<span class="go">    text/plain</span>
</pre></div>
</div>
<p>Optional <em>fp</em> is a file-like object to print the output to.  It must be suitable
for Python&#8217;s extended print statement.  <em>level</em> is used internally.</p>
</dd></dl>

</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
  <h4>Previous topic</h4>
  <p class="topless"><a href="email.util.html"
                        title="previous chapter">18.1.9. <tt class="docutils literal"><span class="pre">email.utils</span></tt>: Miscellaneous utilities</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="email-examples.html"
                        title="next chapter">18.1.11. <tt class="docutils literal"><span class="pre">email</span></tt>: Examples</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
  <li><a href="../bugs.html">Report a Bug</a></li>
  <li><a href="../_sources/library/email.iterators.txt"
         rel="nofollow">Show Source</a></li>
</ul>

<div id="searchbox" style="display: none">
  <h3>Quick search</h3>
    <form class="search" action="../search.html" method="get">
      <input type="text" name="q" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    <p class="searchtip" style="font-size: 90%">
    Enter search terms or a module, class or function name.
    </p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="email-examples.html" title="18.1.11. email: Examples"
             >next</a> |</li>
        <li class="right" >
          <a href="email.util.html" title="18.1.9. email.utils: Miscellaneous utilities"
             >previous</a> |</li>
        <li><img src="../_static/py.png" alt=""
                 style="vertical-align: middle; margin-top: -1px"/></li>
        <li><a href="http://www.python.org/">Python</a> &raquo;</li>
        <li>
          <a href="../index.html">Python 2.7.5 documentation</a> &raquo;
        </li>

          <li><a href="index.html" >The Python Standard Library</a> &raquo;</li>
          <li><a href="netdata.html" >18. Internet Data Handling</a> &raquo;</li>
          <li><a href="email.html" >18.1. <tt class="docutils literal"><span class="pre">email</span></tt> &#8212; An email and MIME handling package</a> &raquo;</li> 
      </ul>
    </div>
    <div class="footer">
    &copy; <a href="../copyright.html">Copyright</a> 1990-2020, Python Software Foundation.
    <br />
    The Python Software Foundation is a non-profit corporation.
    <a href="http://www.python.org/psf/donations/">Please donate.</a>
    <br />
    Last updated on Oct 13, 2020.
    <a href="../bugs.html">Found a bug</a>?
    <br />
    Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3.
    </div>

  </body>
</html>

SEA-GHOST - SHELL CODING BY SEA-GHOST