python在命令行中实时输出数据
PHPz
PHPz 2017-04-18 10:34:10
0
2
454

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

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

什么思路请指点下?

PHPz
PHPz

学习是最好的投资!

reply all (2)
左手右手慢动作

You may want the effect of top or watch command.

Suppose your script is called test.py

You only need to execute watch -n 1 "python test.py"

You can run watch -n 1 "date" to see the effect

Reference:
http://stackoverflow.com/ques...

    巴扎黑

    If you don’t want the screen to scroll but want to see the output, I think you may need to use 'r' instead of 'n'

      Latest Downloads
      More>
      Web Effects
      Website Source Code
      Website Materials
      Front End Template
      About us Disclaimer Sitemap
      php.cn:Public welfare online PHP training,Help PHP learners grow quickly!