我想自动创建在我们的设备VLAN,但我的脚本抛出这个错误:类型错误:只能拼接元组(而不是“STR”)
tn.write(cmd + "\n") TypeError: can only concatenate tuple (not "str") to tuple.
vlannumbers = int(input("Enter the number for vlans :"))
for i in range(2,vlannumbers):
cmd = (("/cfg/l2/vlan "), i)
tn.write(cmd + "\n")
cmd1 = "apply"
tn.write(cmd1 + "\n")
print "ok"
tn.close()
该代码是在正确的格式 – sarfraz
这是什么? 'cmd =((“/ cfg/l2/vlan”),i)'如果'i = 0',那么它应该显示什么? –
如果我= 0它不应该做任何事情在我的设备vlan从1开始,我有范围从2 – sarfraz