Doc: Use the `with` statement in the first example of the ftplib doc. (GH-16271)

This commit is contained in:
Stéphane Wirtel 2019-09-26 09:01:18 +02:00 committed by GitHub
parent 8e7bb991de
commit 5d326abf2c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -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()