Welcome to MLink Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
353 views
in Technique[技术] by (71.8m points)

python在命令行中实时输出数据

想做一个简易的数据监控程序,命令行界面。
python每秒取数据 展示在命令行中,

但是有两个小需求 不知怎么实现 不想要屏幕滚动输出想把屏幕固定,每秒更新命令行中的数据。

什么思路请指点下?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

你可能是想要 top 或者是 watch 命令的效果。

假设你的脚本名字叫 test.py

你只需要执行 watch -n 1 "python test.py"

可以执行看一下效果 watch -n 1 "date"

参考:
http://stackoverflow.com/ques...


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to MLink Developer Q&A Community for programmer and developer-Open, Learning and Share
...