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

没有正确的解决方案

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top