File tree Expand file tree Collapse file tree 1 file changed +8
-10
lines changed Expand file tree Collapse file tree 1 file changed +8
-10
lines changed Original file line number Diff line number Diff line change 1818 Enter the location of the file where the file is received
1919"""
2020
21- def ReceiveFile ():
22- FileName = 'example.txt' """ Enter the location of the file """
23- LocalFile = open (FileName , 'wb' )
24- ftp .retrbinary ('RETR ' + filename , LocalFile .write , 1024 )
25- ftp .quit ()
26- LocalFile .close ()
21+ def receive_file (filename = 'example.txt' ):
22+ with open (filename , 'wb' ) as out_file :
23+ ftp .retrbinary ('RETR ' + filename , out_file .write , 1024 )
24+ ftp .quit ()
2725
2826"""
2927 The file which will be sent via the FTP server
3028 The file send will be send to the current working directory
3129"""
3230
33- def SendFile ( ):
34- FileName = 'example.txt' """ Enter the name of the file """
35- ftp .storbinary ('STOR ' + FileName , open ( FileName , 'rb' ) )
36- ftp .quit ()
31+ def send_file ( filename = 'example.txt' ):
32+ with open ( filename , 'rb' ) as in_file :
33+ ftp .storbinary ('STOR ' + filename , in_file )
34+ ftp .quit ()
You can’t perform that action at this time.
0 commit comments