child = pexpect.popen_spawn.PopenSpawn('ssh pi@192.168.178.34')
a = child.expect(['password:', 'The authenticity of host'], timeout=300, async=True)
if a == 0:
child.sendline('123456789')
print('this ip has exists in know_host files!')
if a == 1:
print('this ip will be added to know_host files!')
child.sendline('yes')
child.expect('password:')
child.sendline('raspberry')
# send test
child.sendline("echo TestMessage")
child.interact()
except pexpect.EOF:
traceback.print_exc()
java控制外层循环一次内层也循环一次 java循环体内外定义变量
1.嵌套for循环1.1 概述根据外层的条件,判断里层能否执行,如果能执行,就把里层代码都循环完毕后,再继续执行外层,继续判断1.2 形式for(...){
for(...){
}1.3 入门案例//总结1:当i=1时,j取到了所有满足条件的数据,1,2,3,4,5
//也就是说外循环执行1次,内循环执行多次
for(int i=1;i<=3;i++) {//外循环