私信  •  关注

dwagnerkc

dwagnerkc 最近创建的主题
dwagnerkc 最近回复了
6 年前
回复了 dwagnerkc 创建的主题 » 在python中循环函数

你需要打电话 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!