Hi!
Looking up the ftplib-Module on my Solaris-Box
>>> print sys.version
2.3.3 (#1, Mar 10 2004, 06:25:19)
[GCC 3.3.2]
I get the following doc for retrlines of the FTP-class:
>>> print myFTP.retrlines.__doc__
Retrieve data in line mode.
The argument is a RETR or LIST command.
The callback function (2nd argument) is called for each line,
with trailing CRLF stripped. This creates a new port for you.
print_line() is the default callback.
Here is stated, that CRLF is stripped for each line.
I've done something similar and opended the targetfile in "binary"-mode.
'wb' instead of 'w', so that there will be no conversion of data during the
write.
The data is retrieved with the following command:
myFTP.retrbinary( "RETR " + dat, open( dat, "wb" ).write )
Ewald
on Tue, 15 Mar 2005 15:30:39 +0100 (CET) �yvind <[EMAIL PROTECTED]> wrote :
---------------------------------------------------------------------------------------------
�yvind > I have opened an FTP connection, and use the following to download a
logfile:
�yvind >
�yvind > f = open('c:///web.log','w')
�yvind > ftp.retrlines('RETR ex050202.log', f.write)
�yvind >
�yvind > I have also tried with f.writelines.
�yvind >
�yvind > It works, but not as well as I would like. All the \n's are removed.
How
�yvind > can I download an exact copy, so that each line actually ends up being
on
�yvind > a separate line?
�yvind >
�yvind > Thanks in advance...
�yvind >
�yvind >
�yvind >
------------------- end ----------------------
--
Ing. Ewald Ertl HartterGruppe Phone :
+43-3352-33085-558
trinomic Projektmanagement & Informationstechnik GmbH Fax :
+43-3352-33085-600
Wiener Stra�e 41 mailto:[EMAIL PROTECTED]
A-7400 Oberwart http://www.trinomic.com mailto:[EMAIL PROTECTED]
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor