H
hawkmoon269
I would like to write a small ftp script that I could use in place of
DOS. So far I have this --
from ftplib import FTP
server = 'xxx'
username = 'xxx'
password = 'xxx'
file = 'xxx'
ftp = FTP(server)
ftp.login(username, password)
ftp.retrlines('RETR ' + file, open('C:\My Documents\' + file,
'w').write
but this just writes the source files contents into a giant string in
the output file. The source file is comma-delimited with a
fixed-length of 80 chars per line. I need the same format for the
output file. I've tried this --
ftp.retrlines('RETR ' + file, open('C:\My Documents\' + file,
'w').write('\n')
and that gives the correct output format...but it writes the output to
the IDE interpreter command line and not the file. What am I doing
wrong?
hawk
DOS. So far I have this --
from ftplib import FTP
server = 'xxx'
username = 'xxx'
password = 'xxx'
file = 'xxx'
ftp = FTP(server)
ftp.login(username, password)
ftp.retrlines('RETR ' + file, open('C:\My Documents\' + file,
'w').write
but this just writes the source files contents into a giant string in
the output file. The source file is comma-delimited with a
fixed-length of 80 chars per line. I need the same format for the
output file. I've tried this --
ftp.retrlines('RETR ' + file, open('C:\My Documents\' + file,
'w').write('\n')
and that gives the correct output format...but it writes the output to
the IDE interpreter command line and not the file. What am I doing
wrong?
hawk