Your best bet would be to use "pexpect" module. Code may look something
like:

import pexpect
import sys
child = pexpect.spawn ('ftp ftp.site.com')
child.expect ('Name .*: ')
child.sendline ('username')
child.expect ('Password:')
child.sendline ('password')
child.expect ('ftp> ')
child.sendline ('cd testdir')
child.expect ('ftp> ')
child.sendline ('bin')
child.expect ('ftp> ')
child.sendline ('hash')
child.expect ('ftp> ')
child.sendline ('get  testfile')
child.expect ('ftp> ')
print child.before  
child.sendline ('bye')

Raghu.
~

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to