【发布时间】:2019-11-23 03:29:55
【问题描述】:
我是 python3 的新手,试图将 python 2.7 代码转换为 python 3,我遇到了这个问题。让我知道我错在哪里。
for n in range (755,767):
tn.write(b"vlan " + str(n) + "\n")
tn.write(b"name Python_VLAN_" + str(n) + "\n")
错误:
Traceback (most recent call last):
File "./telnetlib_vlan_loop.py", line 30, in <module>
tn.write(b"vlan " + str(n) + "\n")
TypeError: can't concat str to bytes**strong text**
【问题讨论】:
标签: python python-3.x for-loop cisco telnetlib