Python 如何获得一个程序,该程序在一段时间后,使用time.sleep(num)输入时间间隔,并进行测量以更改它所用的时间间隔?

Python 如何获得一个程序,该程序在一段时间后,使用time.sleep(num)输入时间间隔,并进行测量以更改它所用的时间间隔?,python,time,intervals,Python,Time,Intervals,我有一个程序,在用户输入的时间延迟后进行测量。但是我希望间隔可以调整,比如在测量一小时后 我试图对整个程序计时,然后将变量处理为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 d

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

我试图对整个程序计时,然后将变量处理为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
并让我知道。

代码的这一部分允许用户以分钟而不是秒为单位输入延迟。