请选择 进入手机版 | 继续访问电脑版

Hello Mat

 找回密码
 立即注册
查看: 7146|回复: 4

定时器Timer

[复制链接]

1294

主题

1520

帖子

110

金钱

管理员

Rank: 9Rank: 9Rank: 9

积分
22633
发表于 2020-5-24 21:57:53 | 显示全部楼层 |阅读模式
定时器Timer:
(1)定时刷新的txt
  1. import time
  2. def trainSeg(x):
  3.     for i in range(3):
  4.         b = x*i*i + x + 1
  5.         txt_file = 'result.txt'
  6.         with open(txt_file,'a') as f:
  7.             f.write(str(b)+'\n')
  8.         f.close();
  9.         time.sleep( 5 )

  10. if __name__ == '__main__':
  11.     x = float(sys.argv[1])
  12.     trainSeg(x)
复制代码


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





算法QQ  3283892722
群智能算法链接http://halcom.cn/forum.php?mod=forumdisplay&fid=73
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Python|Opencv|MATLAB|Halcom.cn ( 蜀ICP备16027072号 )

GMT+8, 2024-4-19 06:38 , Processed in 0.243161 second(s), 24 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表