diff --git a/Doc/library/urllib.request.rst b/Doc/library/urllib.request.rst index 0c5aa0458c6ebe..5d1d8a245907c6 100644 --- a/Doc/library/urllib.request.rst +++ b/Doc/library/urllib.request.rst @@ -1244,7 +1244,10 @@ It is also possible to achieve the same result without using the >>> import urllib.request >>> f = urllib.request.urlopen('http://www.python.org/') - >>> print(f.read(100).decode('utf-8')) + >>> try: + ... print(f.read(100).decode('utf-8')) + ... finally: + ... f.close()