email library, get_payload() bug?

P

peterob

Helllo,

I want to get the raw format of email body. the code Im using is

for part in email.walk():
if part.get_content_maintype() == 'multipart':
continue
if part.get_content_type() == 'text/plain':
# print part.get_content_type()
print part.get_payload(None,True)


The problem is, that code adds one more '\n' at the and of the output
printed by get_payload(). Is that bug?

Thanks.


Best,
Peter
 
A

aspineux

Helllo,

I want to get the raw format of email body. the code Im using is

        for part in email.walk():
                if part.get_content_maintype() == 'multipart':
                        continue
                if part.get_content_type() == 'text/plain':
#                       print part.get_content_type()
                        print part.get_payload(None,True)

The problem is, that code adds one more '\n' at the and of the output
printed by get_payload(). Is that bug?

Thanks.

Best,
Peter

No sure to undeerstand, but print add one '\n' by itself
maybe using

print part.get_payload(None,True),

with a "," at the end to tell print not to add a "\n"

hope this help
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top