我如何获得一个程序,该程序需要测量以更改一段时间后所需的间隔,我正在使用time.sleep(num)输入间隔?



我有一个程序,可以在用户输入的时间延迟后进行测量。但是,我希望在进行一小时测量的时间之后调整间隔

我试图对整个程序进行计时,然后操作变量进入time.sleep((,但这导致了一些不准确。

num=input('insert interval in minutes')
name=str(input('insert file name')
def instrumentcontrol():
#has measurement commands to write and read data.
def dataoutput():
results=pandas.Dataframe()
results=results.append(data,ignore_index=True)
results.to_csv('%s'%name)
def main():
num=mum*60
while True:
instrumentcontrol()
dataoutput()
time.sleep(num)
main()

我想说在运行一个小时后,在 5 分钟处测量间隔 并在运行 2 小时 10 分钟后。

我浏览了您的代码,我看到num = mum*60我认为您正在尝试将秒转换为分钟,请更正该num = num*60并让我知道。

最新更新