Foundations of Python Network Programming
- The comprehensive guide to building network applications with Python
Second Edition
Chapter 12 E-mail Composition and Decoding
Parsing Dates
>>> from email.utils import parsedate_tz, mktime_tz
>>> timetuple1 = parsedate_tz('Sun, 27 May 2007 11:34:43 +1000')
>>> print timetuple1
(2007, 5, 27, 11, 34, 43, 0, 1, -1, 36000)
>>> timestamp1 = mktime_tz(timetuple1)
>>> print timestamp1
1180229683.0
【 在 kongying168 (颖哥儿) 的大作中提到: 】
: 标 题: python 里面应该如何获取email的时间呢?
: 发信站: 水木社区 (Fri Jan 4 17:24:02 2013), 转信
: 比如如下一个邮件信息:
: From Steve_Burt@cursor-system.com Thu Aug 22 12:46:39 2002
: Return-Path:
: Delivered-To: zzzz@localhost.netnoteinc.com
: Received: from localhost (localhost [127.0.0.1])
: by phobos.labs.netnoteinc.com (Postfix) with ESMTP id BE12E43C34
: for ; Thu, 22 Aug 2002 07:46:38 -0400 (EDT)
: Received: from phobos [127.0.0.1]
: ………………
: 可以获取收件人地址,发件人地址,如何获取时间呢?
: --
: 没有执行的愿景只是幻觉!