Domanda

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

Nessuna soluzione corretta

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top