What does “\r” do in the following script?

后端 未结 4 935
傲寒
傲寒 2020-11-28 11:09

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\         


        
4条回答
  •  挽巷
    挽巷 (楼主)
    2020-11-28 11:52

    Actually, this has nothing to do with the usual Windows / Unix \r\n vs \n issue. The TELNET procotol itself defines \r\n as the end-of-line sequence, independently of the operating system. See RFC854.

提交回复
热议问题