0

I can press keys or send text using following method:

tn.write(b"4\n")

How would I do it for UP, DOWN and other arrow keys?

Faisal
  • 159
  • 1
  • 1
  • 13

1 Answers1

1

Possible duplicate of How do I send telnetlib control + c command in python

following worked for me:

# up
tn.write(b"\x1B\x5B\x41\n")

# down
tn.write(b"\x1B\x5B\x42\n")

# left
tn.write(b"\x1B\x5B\x43\n")

# right
tn.write(b"\x1B\x5B\x44\n")
Faisal
  • 159
  • 1
  • 1
  • 13