python中not 3_python3中的expect抛出错误,原因是“must be in str,not bytes”

我正在将代码迁移到python3.4.3。这段代码在python2.4.3中运行良好。但在这里它抛出了python3.4.3中的错误。

我应该使用与expect不同的东西吗?

以下是我的代码片段,其中包含错误:telconn=pexpect.spawn('telnet 10.24.12.83')

telconn.logfile = sys.stdout

login=telconn.expect([":","key to proceed.",">"])

if login==0:

telconn.send("user1" + "\r")

telconn.expect(":")

telconn.send("paswd1" + "\r\r\r\r\n\n\n")

login1=telconn.expect([">","key to proceed."])

if login1==0:

print("nothing")

elif login1==1:

telconn.expect("key to proceed.")

telconn.send ("\003")

telconn.expect(">")

if login==1:

telconn.send ("\003")

telconn.expect(">")

print("ctlc")

elif login==2:

telconn.send("\n\r")

telconn.expect(">")

我得到的错误是:

^{pr2}$

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值