Re: How to get get_body() to work? (about email)

2023-03-20 Thread Jon Ribbens via Python-list
On 2023-03-19, Greg Ewing wrote: > On 20/03/23 7:07 am, Jon Ribbens wrote: >> Ah, apparently it got removed in Python 3, which is a bit odd as the >> last I heard it was added in Python 2.2 in order to achieve consistency >> with other types. > > As far as I remember, the file type came into

Re: How to get get_body() to work? (about email)

2023-03-20 Thread Jon Ribbens via Python-list
On 2023-03-19, Stefan Ram wrote: > Jon Ribbens writes: >>(Also, I too find it annoying to have to avoid, but calling a local >>variable 'file' is somewhat suspect since it shadows the builtin.) > > Thanks for your remarks, but I'm not aware > of such a predefined name "file"! Ah, apparently

Re: How to get get_body() to work? (about email)

2023-03-20 Thread Jon Ribbens via Python-list
On 2023-03-19, Stefan Ram wrote: > Peng Yu writes: >>But when I try the following code, get_body() is not found. How to get >>get_body() to work? > > Did you know that this post of mine here was posted to > Usenet with a Python script I wrote? > > That Python script has a function to show

Re: How to get get_body() to work? (about email)

2023-03-19 Thread Greg Ewing via Python-list
On 20/03/23 7:07 am, Jon Ribbens wrote: Ah, apparently it got removed in Python 3, which is a bit odd as the last I heard it was added in Python 2.2 in order to achieve consistency with other types. As far as I remember, the file type came into existence with type/class unification, and "open"

Re: How to get get_body() to work? (about email)

2023-03-19 Thread Thomas Passin
On 3/18/2023 10:49 PM, Peng Yu wrote: Hi, https://docs.python.org/3/library/email.parser.html It says "For MIME messages, the root object will return True from its is_multipart() method, and the subparts can be accessed via the payload manipulation methods, such as get_body(), iter_parts(),

How to get get_body() to work? (about email)

2023-03-19 Thread Peng Yu
Hi, https://docs.python.org/3/library/email.parser.html It says "For MIME messages, the root object will return True from its is_multipart() method, and the subparts can be accessed via the payload manipulation methods, such as get_body(), iter_parts(), and walk()." But when I try the following