我想在python中使用telnet庫從設備獲取信息。然而,我有一個錯誤,如上所列,當我嘗試運行我的代碼時被拋出。'str'對象不支持項目分配telnetlib
'海峽' 對象不支持項目分配
tn = telnetlib.Telnet(host)
tn.expect([r".*ogin:.*", r".*sername:.*"])
tn.write(username+"\n")
tn.expect(r".*assword:.*")
tn.write(password+"\n")
tn.write("terminal length 0"+"\n")
tn.write("show " + configType + "-config"+"\n")
tn.write("exit"+"\n")
output = tn.read_all()
追溯哪裏? –