diff options
| author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2019-09-26 07:12:26 (GMT) |
|---|---|---|
| committer | Stéphane Wirtel <stephane@wirtel.be> | 2019-09-26 07:12:26 (GMT) |
| commit | 80bde157368fd45d5a5bfd6e8564a14bdec5494c (patch) | |
| tree | 13cfcaa6105e9ebb693ae336879dcd06cb2d9ce5 /Doc/library | |
| parent | 8e4622ea898bdda687eb2fb0747721c0cd8b0d02 (diff) | |
| download | cpython-80bde157368fd45d5a5bfd6e8564a14bdec5494c.zip cpython-80bde157368fd45d5a5bfd6e8564a14bdec5494c.tar.gz cpython-80bde157368fd45d5a5bfd6e8564a14bdec5494c.tar.bz2 | |
Doc: Use the `with` statement in the first example of the ftplib doc. (GH-16271) (GH-16413)
(cherry picked from commit 5d326abf2cb4891b78d9319a81bffb3974b5b745)
Co-authored-by: Stéphane Wirtel <stephane@wirtel.be>
Diffstat (limited to 'Doc/library')
| -rw-r--r-- | Doc/library/ftplib.rst | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Doc/library/ftplib.rst b/Doc/library/ftplib.rst index 6c39f9a..d9701f4 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() |
