gpt4 book ai didi

python - 未定义计划名称

转载 作者:太空宇宙 更新时间:2023-11-03 20:14:13 24 4
gpt4 key购买 nike

我对此很陌生。我正在尝试安排一些事情。假设周[4] = 1

week = [monday, tuesday, wednesday, thursday, friday, saturday, sunday]

if week[4] == 1:
print("HELLO WORLD")
schedule.every().friday.at(startTime).do(lightOn)
while True:
schedule.run_pending()
time.sleep(1)

schedule.every().friday.at(endTime).do(lightOff)
while True:
schedule.run_pending()
time.sleep(1)

我的开灯和关灯代码是

    def lightOff(self):
lightY = lightA(light = 0)
lightOff = lightY.save()
return lightOff

def lightOn(self):
lightX = lightA(light = 1)
lightOn = lightX.save()
return lightOn

我收到错误“名称计划未定义”。有人可以指出我正确的方式吗?是的,我确实安装了“pip install Schedule”

最佳答案

为了让您的程序识别时间表,您需要:

  1. 使用pip安装计划安装它
  2. 在程序开始时通过导入计划导入它。

关于python - 未定义计划名称,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58561752/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com