Question

I have a text file in an FTP server. How would I be able to open this file directly on the server? I have the following and I am able to log in, but I know something is wrong with how I am opening the file. I'm a huge Python noob, so I apologize if this is a really obvious question.

from ftplib import FTP
ftp = FTP('127.0.0.1')
ftp.login('USERNAME', 'PASS')
op = ftp.retrbinary('RETR file.txt', open('file.txt', 'r'))
txt = op.read()
print txt

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top