Going ctrl + z to pexpect

How can I pass a specific key combination to a spawned / child process using the pexpect module? I am using telnet and have to send Ctrl + Z to the remote server.

Tpx

+2


source to share


1 answer


use sendcontrol ()

eg:



p = pexpect.spawn(your_cmd_here)
p.sendcontrol('z')

      

+7


source







All Articles