import ftplibimport os# Connect to serverftp = ftplib.FTP( "127.0.0.1" )ftp.set_pasv( False ) # Note that we need no authentication at all!! print ftp.retrlines( 'LIST' )print ftp.retrbinary('RETR changelog.txt', open('changelog.txt', 'wb').write ) # filename = 'test.txt'# f = open( filename, 'rb' ) # print ftp.storbinary( 'STOR ' + filename, f )# f.close()ftp.quit()