[docs] [issue12955] urllib.request example should use "with ... as:"

Martin Panter report at bugs.python.org
Mon Feb 9 02:22:17 CET 2015


Martin Panter added the comment:

Here is a patch to change the urlopen() examples to use context managers where appropriate.

There were also a few examples of handling HTTPError which I didn’t touch, because the whole file object versus exception object thing is probably a separate can of worms.

----------
keywords: +patch
Added file: http://bugs.python.org/file38049/urlopen-with.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue12955>
_______________________________________


More information about the docs mailing list