バイトのようなオブジェクトが必要とされ、「STR」ではない(Liberty-)Basicについて以来のPythonを使用して1980年別の例外TypeError:私はPythonで完全な初心者だけど、私は楽しみのためにプログラミングされている
3.5.2私はこのスクリプトをテストしていた:バイトのようなオブジェクトが必要な、ない「str」はとどのように私はそれを解決することができます:私はTypeError例外を取得する理由
import time, telnetlib
host = "dxc.ve7cc.net"
port = 23
timeout = 9999
try:
session = telnetlib.Telnet(host, port, timeout)
except socket.timeout:
print ("socket timeout")
else:
session.read_until("login: ")
session.write("on0xxx\n")
output = session.read_some()
while output:
print (output)
time.sleep(0.1) # let the buffer fill up a bit
output = session.read_some()
誰も教えてもらえますか?
[TypeError: 'str'ではなく、バイトのようなオブジェクトが必要です(http://stackoverflow.com/questions/33003498/typeerror-a-bytes-like-object-is-required-not) -str) –