Reading mail getting [<email.message.Message object at 0x02209970>, ...

dieter dieter at handshake.de
Sat Dec 14 03:49:35 EST 2019


Abdur-Rahmaan Janhangeer <arj.python at gmail.com> writes:

> Can you please indicate where is the header in my code above? Thanks.

Python is an object oriented language. As a consequence,
Python functions often return complex objects and not only
elementary objects. Use the documentation of the complex object's class
to find out how to work with them.

In general, Python has two functions to get a readable
description for an object: "repr" and "str".
"<email.message.Message object at 0x02209970>" is a typical
return value for "repr". Apply "str" to this message object
to get a representation which likely fits better your expectations.

Read the documentation for "email.message.Message" to learn how
to work with those "Message" objects on a more granular level.



More information about the Python-list mailing list