[Python] pexpect and sending an "Enter Key" issues

Discussão em 'Python' iniciado por Stack, Março 3, 2025.

  1. Stack

    Stack Membro Participativo

    I am using pexpect with python 2.7. I am currently writing a script to login to a jump server and then subsequently login to some cisco devices to perform some operations in an automated way.

    There is a stage during the login process, where I need to send just a blank line by pressing 'Enter/Return' on the keyboard. After reading many of the posts and other forums, I have tried the following:

    <handler>.sendline()
    <handler>.sendline('')
    <handler>.send('\013')


    However, none of these seem to work for me. When I do login manually to the server and attempt to hit Enter/Return, I see a "C" on the screen and the login process proceeds forward.

    I am not sure what the "C" means, however if anyone can help or provide some insight here, it would be really helpful.

    Continue reading...

Compartilhe esta Página