<small id='Z8ZN5'></small><noframes id='Z8ZN5'>

  • <legend id='Z8ZN5'><style id='Z8ZN5'><dir id='Z8ZN5'><q id='Z8ZN5'></q></dir></style></legend>

      1. <i id='Z8ZN5'><tr id='Z8ZN5'><dt id='Z8ZN5'><q id='Z8ZN5'><span id='Z8ZN5'><b id='Z8ZN5'><form id='Z8ZN5'><ins id='Z8ZN5'></ins><ul id='Z8ZN5'></ul><sub id='Z8ZN5'></sub></form><legend id='Z8ZN5'></legend><bdo id='Z8ZN5'><pre id='Z8ZN5'><center id='Z8ZN5'></center></pre></bdo></b><th id='Z8ZN5'></th></span></q></dt></tr></i><div id='Z8ZN5'><tfoot id='Z8ZN5'></tfoot><dl id='Z8ZN5'><fieldset id='Z8ZN5'></fieldset></dl></div>
        <tfoot id='Z8ZN5'></tfoot>
          <bdo id='Z8ZN5'></bdo><ul id='Z8ZN5'></ul>
      2. 使用 utf-8 编码的主题的 Python IMAP 搜索

        Python IMAP search using a subject encoded with utf-8(使用 utf-8 编码的主题的 Python IMAP 搜索)

            <tbody id='oN5cz'></tbody>
            <tfoot id='oN5cz'></tfoot>
              • <bdo id='oN5cz'></bdo><ul id='oN5cz'></ul>
                <i id='oN5cz'><tr id='oN5cz'><dt id='oN5cz'><q id='oN5cz'><span id='oN5cz'><b id='oN5cz'><form id='oN5cz'><ins id='oN5cz'></ins><ul id='oN5cz'></ul><sub id='oN5cz'></sub></form><legend id='oN5cz'></legend><bdo id='oN5cz'><pre id='oN5cz'><center id='oN5cz'></center></pre></bdo></b><th id='oN5cz'></th></span></q></dt></tr></i><div id='oN5cz'><tfoot id='oN5cz'></tfoot><dl id='oN5cz'><fieldset id='oN5cz'></fieldset></dl></div>

                <small id='oN5cz'></small><noframes id='oN5cz'>

                <legend id='oN5cz'><style id='oN5cz'><dir id='oN5cz'><q id='oN5cz'></q></dir></style></legend>

                • 本文介绍了使用 utf-8 编码的主题的 Python IMAP 搜索的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  此问题与问题 Python 有关使用 iso-8859-1 编码的主题进行 IMAP 搜索,但那里给出的回复对我不起作用.

                  This question is related to question Python IMAP search using a subject encoded with iso-8859-1, but the reply given there is not working for me.

                  我正在 python 中进行以下 IMAP 搜索:

                  I am doing the following IMAP search in python:

                  typ, data = self.M.search("utf-8", "(SUBJECT %s)" % u"réception".encode("utf-8"))
                  

                  我得到以下异常:

                  ...
                      typ, data = self.M.search("utf-8", "(SUBJECT %s)" % u"réception".encode("utf-8"))
                    File "/usr/local/python/2.7.2/lib/python2.7/imaplib.py", line 625, in search
                      typ, dat = self._simple_command(name, 'CHARSET', charset, *criteria)
                    File "/usr/local/python/2.7.2/lib/python2.7/imaplib.py", line 1070, in _simple_command
                      return self._command_complete(name, self._command(name, *args))
                    File "/usr/local/python/2.7.2/lib/python2.7/imaplib.py", line 905, in _command_complete
                      raise self.error('%s command error: %s %s' % (name, typ, data))
                  error: SEARCH command error: BAD ['Could not parse command']
                  

                  这是为什么呢?我该如何解决这个问题?

                  Why is that? How can I solve this problem?

                  推荐答案

                  import imaplib
                  import getpass
                  email = "XXXXXXX@gmail.com"
                  
                  sock = imaplib.IMAP4_SSL("imap.gmail.com", 993)
                  sock.login(email, getpass.getpass())
                  
                  # select the correct mailbox...
                  sock.select()
                  # turn on debugging if you like
                  sock.debug = 4
                  

                  然后:

                  # use the undocumented IMAP4.literal attribute
                  sock.literal = "réception"
                  sock.uid('SEARCH', 'CHARSET', 'UTF-8', 'SUBJECT')
                  

                  这篇关于使用 utf-8 编码的主题的 Python IMAP 搜索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Running .jl file from R or Python(从 R 或 Python 运行 .jl 文件)
                  Running Julia .jl file in python(在 python 中运行 Julia .jl 文件)
                  Using PIP in a Azure WebApp(在 Azure WebApp 中使用 PIP)
                  How to run python3.7 based flask web api on azure(如何在 azure 上运行基于 python3.7 的烧瓶 web api)
                  Azure Python Web App Internal Server Error(Azure Python Web 应用程序内部服务器错误)
                  Run python dlib library on azure app service(在 azure app 服务上运行 python dlib 库)
                • <i id='0YEPL'><tr id='0YEPL'><dt id='0YEPL'><q id='0YEPL'><span id='0YEPL'><b id='0YEPL'><form id='0YEPL'><ins id='0YEPL'></ins><ul id='0YEPL'></ul><sub id='0YEPL'></sub></form><legend id='0YEPL'></legend><bdo id='0YEPL'><pre id='0YEPL'><center id='0YEPL'></center></pre></bdo></b><th id='0YEPL'></th></span></q></dt></tr></i><div id='0YEPL'><tfoot id='0YEPL'></tfoot><dl id='0YEPL'><fieldset id='0YEPL'></fieldset></dl></div>

                  <small id='0YEPL'></small><noframes id='0YEPL'>

                • <tfoot id='0YEPL'></tfoot>
                  <legend id='0YEPL'><style id='0YEPL'><dir id='0YEPL'><q id='0YEPL'></q></dir></style></legend>

                      <tbody id='0YEPL'></tbody>

                      <bdo id='0YEPL'></bdo><ul id='0YEPL'></ul>