Rather than doing anything with passwords, you should instead use public key authentication. This involves creating a keypair with ssh_keygen, putting the private key on the machine opening the ssh connection (~/.ssh/id_rsa), then listing the public key in the remote system's ~/.ssh/authorized_keys.
If you don't want to use this approach, `pexpect'[1] is supposed to be able to perform this sort of tasks, and one of its examples is called `sshls.py'. I just downloaded it, and after changing the ssh commandline to include -o 'PreferredAuthentications password' it worked for me. In another recent thread, a different poster claimed it didn't work, so your results may vary. Jeff [1] http://pexpect.sourceforge.net/
pgprScaQubqXA.pgp
Description: PGP signature
-- http://mail.python.org/mailman/listinfo/python-list