I am using following script to reboot my router using Telnet:
#!/usr/bin/env python
import os
import telnetlib
from time import sleep
host = \"192.168.1.1\
\r is the ASCII Carriage Return (CR) character.
There are different newline conventions used by different operating systems. The most common ones are:
\r\n);\n);\r).The \n\r (LF+CR) looks unconventional.
edit: My reading of the Telnet RFC suggests that:
The sequence "CR LF", as defined, will cause the NVT to be positioned at the left margin of the next print line (as would, for example, the sequence "LF CR").