How do I send telnetlib control + c command in python

Dhruv Patel picture Dhruv Patel · Oct 3, 2014 · Viewed 8.2k times · Source

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?

Answer

Hussain Shabbir picture Hussain Shabbir · Oct 3, 2014

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

tn.write('\x03')