Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #5131
| From | TheSaint <nobody@nowhere.net.no> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: Py3k,email header handling |
| Followup-To | comp.lang.python |
| Date | 2011-05-12 00:27 +0800 |
| Organization | Aioe.org NNTP Server |
| Message-ID | <iqedda$p9f$1@speranza.aioe.org> (permalink) |
| References | <iqdftv$age$1@speranza.aioe.org> <4dca92b1$0$29980$c3e8da3$5496439d@news.astraweb.com> |
Followups directed to: comp.lang.python
Steven D'Aprano wrote:
> Before you re-write it, you should run 2to3 over it and see how much it
> can do automatically:
Widely done, only the results from some query has radically changed on
favour of unicode. Errors raising about results which are not strings
anymore.
> I'm afraid I don't understand the question.
Making an example :
from poplib import POP3 as pop3
pop3.user('userid')
pop3.pass_('password')
numMsg, total = pop3.stat()
for cnt in numMsgs:
header = pop3.top(cnt)
# here I'd like to pass the header to some function that will return
# a dictionary filling
# from', 'to', 'cc', 'bcc', 'date', 'subject', 'reply-to', 'message-id'
# keys, if nothing the leave empty string or None
dict = email.header,decode_header(header) # but might not my result
# Should I subclass this?
The same would be from the IMAP4 message parsing. Some different process
would take, would it ?
> If you have any more concrete questions, please ask.
If these aren't concrete questions, forgive me, I perhaps got into wrong
news group.
In the other and I hugely apreciated your clues. I'll see the docs some more
long to achieve a clear learning.
--
goto /dev/null
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Py3k,email header handling TheSaint <nobody@nowhere.net.no> - 2011-05-11 16:04 +0800
Re: Py3k,email header handling Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-05-11 13:44 +0000
Re: Py3k,email header handling TheSaint <nobody@nowhere.net.no> - 2011-05-12 00:27 +0800
Re: Py3k,email header handling Terry Reedy <tjreedy@udel.edu> - 2011-05-11 13:56 -0400
csiph-web