python else语句和if语句的组合_python同时执行if和else语句

我的问题是python我们同时执行if和else语句

我试过“如果不是”,独立于其他的,但似乎没有任何效果。在

这是我剧本的一部分。我对这件事不太熟悉,所以我很感激你的帮助。在

我要做的是,如果cofig中有255.255.255.252,我要读取。(这起作用了,并相应地改变了配置)但是如果没有255.255.255.252,我的日志中应该有一个打印。在

结果是:(两者兼而有之)

2017-10-26 15:39:29350 dailer 1关闭IP测试路由器完成

2017-10-26 15:39:29351 dailer 1 off IP lprm1212没有/30for my_output in result0.split("\n"):

if len(my_output) !=0:

if my_output.find("255.255.255.252") != -1:

print (my_output)

tn.read_until('')

tn.write("config terminal"+"\n")

tn.read_until("(config)#")

tn.write("interface Dialer1"+"\n")

tn.read_until("(config-if)#")

tn.write("description test"+"\n")

tn.write("end"+"\n")

logger.debug('dailer 1 off IP ' + host2login + ' is completed')

else:

logger.debug('dailer 1 off IP ' + host2login + ' has no /30')

else:

logger.debug('dailer 1 off IP ' + host2login + ' has no /30')

else:

logger.debug('dailer 1 off IP ' + host2login + ' has no /30')

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值