【发布时间】:2022-10-17 08:55:35
【问题描述】:
我在覆盆子上有一个 LED 灯条,想通过颜色在 LED 灯条上指示互联网的状态。
现在我想出了这个:
import os
hostname = "google.com" #example
response = os.system("ping -c 1 " + hostname)
#and then check the response...
if response == 0:
exec(open("random_blink.py").read())
else:
exec(open("random_blink_colours.py").read())
如何让脚本每 10 秒重新运行一次?
【问题讨论】:
标签: python