你需要打电话
macGrabber
A内
try...except
封锁和呼叫
continue
如果您想继续循环而不让程序崩溃。
multiple_devices = [
(child1, switch1, cat1),
(child2, switch2, cat2),
...,
]
for device in multiple_devices:
try:
macGrabber(*device)
except pexpect.TIMEOUT as e:
print(f'{device} timed out')
print(e)
continue # <--- Keep going!