Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > [python] Figured out how to go from email.Message.Message to string

Reply
Thread Tools

[python] Figured out how to go from email.Message.Message to string

 
 
David Stockwell
Guest
Posts: n/a
 
      06-17-2004
It took a little bit of digging but I finally figured it out by looking in
my /usr/local/lib/py* directory's python modules.

Turns out in the Message.py module there is a __str__ method you can call to
convert to a string. And when i read more I found out its doing a fancy
flatten. I've seen references to flatten around so this will help reinforce
in my mind what it means for a flat tened or flat python object.




David
-------
Tracfone: http://cellphone.duneram.com/index.html
Cam: http://www.duneram.com/cam/index.html
Tax: http://www.duneram.com/index.html

__________________________________________________ _______________
Looking to buy a house? Get informed with the Home Buying Guide from MSN
House & Home. http://coldwellbanker.msn.com/


 
Reply With Quote
 
 
 
 
David Bolen
Guest
Posts: n/a
 
      06-17-2004
"David Stockwell" <(E-Mail Removed)> writes:

> Turns out in the Message.py module there is a __str__ method you can
> call to convert to a string. And when i read more I found out its
> doing a fancy flatten. I've seen references to flatten around so this
> will help reinforce in my mind what it means for a flat tened or flat
> python object.


Note that any object's __str__ method provides a default way to create
a "nicely" printable string representation of that object, but you
won't normally call that method directly. Instead, it will be called
indirectly if you use the object in a print statement, or as an
argument to the %s string formatting operator, or if you use the str()
built-in method on that object.

Also note that the __str__ implementation for Message includes a Unix
formatted "From" line (the format used in some Unix mailbox files).
If you just want the plain message, you may want to use the
as_string() method on the Message object instead which has a parameter
to conditionalize the from line (off by default).

-- David
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
WOO-HOO!! I figured it out! (Was Citrix Metaframe XP) Ben E. Hanna Computer Support 0 12-18-2004 05:27 PM
I finally figured it out! namespaces and the ODR Steven T. Hatton C++ 1 08-15-2004 01:22 PM
I think i figured out the list problem [python] David Stockwell Python 0 06-07-2004 12:33 PM
Figured out pbase problem... Brian C. Baird Digital Photography 2 06-03-2004 03:44 PM



Advertisments