Issue #12955: Change the urlopen() examples to use context managers where appropriate.
Patch by Martin Panter.
diff --git a/Doc/faq/library.rst b/Doc/faq/library.rst
index d71a9b4..064728f 100644
--- a/Doc/faq/library.rst
+++ b/Doc/faq/library.rst
@@ -687,7 +687,8 @@
### connect and send the server a path
req = urllib.request.urlopen('http://www.some-server.out-there'
'/cgi-bin/some-cgi-script', data=qs)
- msg, hdrs = req.read(), req.info()
+ with req:
+ msg, hdrs = req.read(), req.info()
Note that in general for percent-encoded POST operations, query strings must be
quoted using :func:`urllib.parse.urlencode`. For example, to send