Halcom 发表于 2020-5-24 21:57:53

定时器Timer

定时器Timer:
(1)定时刷新的txtimport time
def trainSeg(x):
    for i in range(3):
      b = x*i*i + x + 1
      txt_file = 'result.txt'
      with open(txt_file,'a') as f:
            f.write(str(b)+'\n')
      f.close();
      time.sleep( 5 )

if __name__ == '__main__':
    x = float(sys.argv)
    trainSeg(x)

参考:
【1】C#里面的三种定时计时器:Timer
【2】C#如何实现读取一个实时更新的文本文件
【3】C# FileSystemWatcher监听文件事件
【4】C# FileSystemWatcher 在监控文件夹和文件时的用法





页: [1]
查看完整版本: 定时器Timer