3

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
hydronium
  • 198
  • 3
  • 11
Joe Knupp
  • 31
  • 1
  • 3
  • Duplicate of https://stackoverflow.com/questions/11208957/is-it-possible-to-read-ftp-files-without-writing-them-using-python ? – pseudocubic Feb 11 '14 at 03:31

0 Answers0