Search code examples
pythontelnettelnetlib

How do I send telnetlib control + c command in python


I am trying to send control + c command in python using telnetlib library. Currently I am doing

tn.write('^]')

But the code above doesn't seem to work. Any clue on What I should use?


Solution

  • Try ASCII characters of control+c to the telnet connection below:-

    tn.write('\x03')