Pexpect

Joaquin Alzola Joaquin.Alzola at lebara.com
Fri Jan 6 06:37:24 EST 2017


> How to match latter(caps and small) ,numbers and # symbol in python pexpect.

With a .*

        child = pexpect.spawnu("ssh cbpapp@%s"% CBP[cust_cbp_server])
        child.setecho(False)
        child.logfile = open("/opt/webapi/logs/delete_accountID.log", "w")
        child.expect(".*assword:")
        child.sendline("XXXX\r")
        child.expect(".*/onip/app/cbpapp>")
        child.sendline("mdsql\r")
        child.expect("SQL>")
        child.sendline("select * from table; \r")
        child.expect("SQL>")
        child.expect("SQL>")

-----

This email is confidential and may be subject to privilege. If you are not the intended recipient, please do not copy or disclose its content but contact the sender immediately upon receipt.


More information about the Python-list mailing list