diff options
| author | Berker Peksag <berker.peksag@gmail.com> | 2015-02-25 16:14:09 (GMT) |
|---|---|---|
| committer | Berker Peksag <berker.peksag@gmail.com> | 2015-02-25 16:14:09 (GMT) |
| commit | f9e3cf1f9f6eaefba19593783e1cdf7681d1fa65 (patch) | |
| tree | cbaa625efe90eefd38a96cc7577e2d28b135cae0 /Doc/includes/email-headers.py | |
| parent | b808d590a24066bc03d21b55ed5e890a012477a8 (diff) | |
| download | cpython-f9e3cf1f9f6eaefba19593783e1cdf7681d1fa65.zip cpython-f9e3cf1f9f6eaefba19593783e1cdf7681d1fa65.tar.gz cpython-f9e3cf1f9f6eaefba19593783e1cdf7681d1fa65.tar.bz2 | |
Issue #23511: Port email-simple.py to Python 3.
Also, update email examples to use the context manager version of open().
Patch by Baptiste Mispelon.
Diffstat (limited to 'Doc/includes/email-headers.py')
| -rw-r--r-- | Doc/includes/email-headers.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Doc/includes/email-headers.py b/Doc/includes/email-headers.py index a53317d..89c8f3a 100644 --- a/Doc/includes/email-headers.py +++ b/Doc/includes/email-headers.py @@ -1,8 +1,9 @@ # Import the email modules we'll need from email.parser import Parser -# If the e-mail headers are in a file, uncomment this line: -#headers = Parser().parse(open(messagefile, 'r')) +# If the e-mail headers are in a file, uncomment these two lines: +# with open(messagefile) as fp: +# headers = Parser().parse(fp) # Or for parsing headers in a string, use: headers = Parser().parsestr('From: <user@example.com>\n' |
