标签:
# pip install pexpect 或 # easy_install pexpect
1 #!/usr/bin/env python 2 import pexpect 3 child = pexpect.spawn(‘/usr/bin/scp /root/pexpect/haha 172.16.65.201:/tmp/‘) 4 child.expect(‘password:‘) 5 child.sendline(‘rootroot‘) 6 child.expect(pexpect.EOF)
标签:
原文地址:http://www.cnblogs.com/wjoyxt/p/5057760.html