Victor Stinner's patch to make telnetlib use bytes 3725

This commit is contained in:
Benjamin Peterson 2008-10-15 20:54:24 +00:00
parent 33b6450d23
commit 3de7fb86fc
3 changed files with 109 additions and 107 deletions

View file

@ -225,14 +225,14 @@ A simple example illustrating typical use::
tn = telnetlib.Telnet(HOST)
tn.read_until("login: ")
tn.write(user + "\n")
tn.read_until(b"login: ")
tn.write(user.encode('ascii') + b"\n")
if password:
tn.read_until("Password: ")
tn.write(password + "\n")
tn.read_until(b"Password: ")
tn.write(password.encode('ascii') + b"\n")
tn.write("ls\n")
tn.write("exit\n")
tn.write(b"ls\n")
tn.write(b"exit\n")
print(tn.read_all())