How to capture stdout into a string?
michael at damaru.com
Sun Jun 9 19:10:30 CEST 2002
I'm using libftp. The FTP.dir() function gets the remote directory listing
and prints it to standard out. How can I capture that in a string?
If I were using an external process, I know I could open a pipe to it. But
it's not an external process.
I'm sure there's a tricky way of doing it by getting the file descriptor for
stdout and reading from it directly, but I was hoping to avoid going that
low-level. I will if I must though.
Thanks in advance,
Custom Programming - Web Development - Database Design
More information about the Python-list