telnet problem

神父 wxj0302 at
Fri Nov 1 15:16:40 CET 2013

hello every expert,
When I use telnetlib to send a command, I meet some troubles, I have read
some documents about telnetlib and modify many times, but the script
doesn't work all the time. I want to know why.
My script is following:
import telnetlib

t = telnetlib.Telnet()'',port=23)
t.read_until("login: ")
t.write('administrator' + '\r\n')
t.read_until("password: ")
t.write('abc123' + '\r\n')
t.write('dir' + '\r\n')
t.write('exit' + '\r\n')
print t.read_all()

Thanks and best regards

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list