python expect

 

 

#!/usr/bin/python

import pexpect

foo = pexpect.spawn('passwd mqjia')

foo.expect("New UNIX password:")

foo.sendline("1234567")

foo.expect("Retype new UNIX password:")

foo.sendline("1234567")

foo.interact()

 

 

 

你可能感兴趣的:(职场,休闲,恶性)