Skip to content

Commit 80bde15

Browse files
Doc: Use the with statement in the first example of the ftplib doc. (GH-16271) (GH-16413)
(cherry picked from commit 5d326ab) Co-authored-by: Stéphane Wirtel <[email protected]>
1 parent 8e4622e commit 80bde15

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Doc/library/ftplib.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ Here's a sample session using the :mod:`ftplib` module::
3333
drwxr-sr-x 4 1176 1176 4096 Nov 17 2008 project
3434
drwxr-xr-x 3 1176 1176 4096 Oct 10 2012 tools
3535
'226 Directory send OK.'
36-
>>> ftp.retrbinary('RETR README', open('README', 'wb').write)
36+
>>> with open('README', 'wb') as fp:
37+
>>> ftp.retrbinary('RETR README', fp.write)
3738
'226 Transfer complete.'
3839
>>> ftp.quit()
3940

0 commit comments

Comments
 (0)