[Python-checkins] (no subject)
Stéphane Wirtel
webhook-mailer at python.org
Thu Sep 26 03:12:30 EDT 2019
To: python-checkins at python.org
Subject: Doc: Use the `with` statement in the first example of the ftplib doc.
(GH-16271) (GH-16413)
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
https://github.com/python/cpython/commit/80bde157368fd45d5a5bfd6e8564a14bdec5=
494c
commit: 80bde157368fd45d5a5bfd6e8564a14bdec5494c
branch: 3.7
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.co=
m>
committer: St=C3=A9phane Wirtel <stephane at wirtel.be>
date: 2019-09-26T09:12:26+02:00
summary:
Doc: Use the `with` statement in the first example of the ftplib doc. (GH-162=
71) (GH-16413)
(cherry picked from commit 5d326abf2cb4891b78d9319a81bffb3974b5b745)
Co-authored-by: St=C3=A9phane Wirtel <stephane at wirtel.be>
files:
M Doc/library/ftplib.rst
diff --git a/Doc/library/ftplib.rst b/Doc/library/ftplib.rst
index 6c39f9a59fc1..d9701f4871d9 100644
--- a/Doc/library/ftplib.rst
+++ b/Doc/library/ftplib.rst
@@ -33,7 +33,8 @@ Here's a sample session using the :mod:`ftplib` module::
drwxr-sr-x 4 1176 1176 4096 Nov 17 2008 project
drwxr-xr-x 3 1176 1176 4096 Oct 10 2012 tools
'226 Directory send OK.'
- >>> ftp.retrbinary('RETR README', open('README', 'wb').write)
+ >>> with open('README', 'wb') as fp:
+ >>> ftp.retrbinary('RETR README', fp.write)
'226 Transfer complete.'
>>> ftp.quit()
=20
More information about the Python-checkins
mailing list