How do I read a text file on an FTP server in Python
Frage
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
Keine korrekte Lösung
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow