我试图在一个嵌入的电子邮件中抓取图像。问题是我保存的图像不可读,我不知道为什么。
电子邮件(保存为我在代码开头加载的文件):MIME-Version: 1.0
Received: by 10.100.120.7 with HTTP; Tue, 18 Oct 2011 10:36:48 -0700 (PDT)
In-Reply-To: <8B4FDE07A4759840B84FD04B4C88100B010135E81D8C@fxildc03.forexmanage.com>
References: <8B4FDE07A4759840B84FD04B4C88100B010135E81D8C@fxildc03.forexmanage.com>
Date: Tue, 18 Oct 2011 19:36:48 +0200
Delivered-To: s.shpiz@gmail.com
Message-ID:
Subject: openme
From: Simeon Shpiz
To: me
Content-Type: multipart/related; boundary=001636c5977303b92404af962ba6
--001636c5977303b92404af962ba6
Content-Type: multipart/alternative; boundary=001636c5977303b91d04af962ba5
--001636c5977303b91d04af962ba5
Content-Type: text/plain; charset=ISO-8859-1
****
--001636c5977303b91d04af962ba5
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
e" vlink=3D"purple">
.0pt;color:#1F497D">
@01CC8DCD.30A2A7C0">
<=u>
--001636c5977303b91d04af962ba5--
--001636c5977303b92404af962ba6
Content-Type: image/png; name="image003.png"
Content-Transfer-Encoding: base64
Content-ID:
X-Attachment-Id: 3e79c375acccec3d_0.1
iVBORw0KGgoAAAANSUhEUgAAAA4AAAANCAIAAAAWvsgoAAAAAXNSR0IArs4c6QAAAAlwSFlzAAAO
yAAADsMBrahYpwAAAItJREFUKFNj/P//PwNxgIk4ZWBVQFOBoBsMsGqrqqr6CgYsaNIPHz6EiMjJ
yb19+xbISE9PLy4uBjLQlSLrFBYWBnITExN9fHyADMJulZCQgOgnrFRUVJRYpXAnETb19evXxJr6
4sULiFJ8IfDt2zegii1btmRkZGBRKi8vjxbSwKjJysoCCjISnwYATtwwhahioZoAAAAASUVORK5C
YII=
--001636c5977303b92404af962ba6--
我使用的python代码:
^{pr2}$
不幸的是,保存的图像不好。(没有程序打开它)。在
我用notepad++查看了原始图像文件和新的图像文件,但有一个不同之处——我生成的副本看起来有一个换行符,而我生成的副本在原始文件中不存在。这并不是唯一的区别,因为在记事本++中删除行并不能使图像打开。我所描述的区别可以看出here
如果您能帮忙找到问题,我们将不胜感激。在