2021
03-02
03-02
python中Pexpect的工作流程实例讲解
1、工作流程步骤(1)用spawn来执行一个程序;(2)用expect方法来等待指定的关键字,这个关键字是被执行的程序打印到标准输出上面的;(3)当发现这个关键字以后,使用send/sendline方法发送字符串给这个程序。2、实例spawn类classspawn(SpawnBase):'''ThisisthemainclassinterfaceforPexpect.Usethisclasstostartandcontrolchildapplications.'''#Thisispurelyinformationalnow-changingithasn...
继续阅读 >