我想达到的目的是,输出实时保存到 txt 里(同时每行加上时间)且在 cmd 里也实时打印出来。
|
fcceMay 24, 2018
1
shell 直接就搞定了,为什么要用 python,|tee 了解一下?
|
|
edsion996May 24, 2018
2
重定向到文件,Python 读取文件
|
|
3
@kalelfc 谢谢,我又有个问题了,adb shell top -m 10 |tee aa.txt 是 work 的
adb shell top -m 10 |grep com.jingdong.app.mall|tee aa.txt 就没有输出了 |
|
ptreesMay 24, 2018
5
额..没看仔细,怎么删掉自己的回复...
|
|
jalenaMay 24, 2018
6
adb shell top -m 10 |grep com.jingdong.app.mall >> tee aa.txt
|
|
jalenaMay 24, 2018
7
adb shell top -m 10 |grep com.jingdong.app.mall >> aa.txt
|
|
Loner233May 24, 2018
8
>>> from subprocess import check_output
>>> out = check_output(["ls", "-al"]) |
|
9
最后我用 python 写了一个,shell 也可以做到 while true;do (adb shell top -m 10 -n 1 |grep com.jingdong.app.mall|tee -a aa.txt);done
|
|
HLLiuMay 29, 2018
10
刚想问下楼主怎么实现的,因为我最近也想直接想办法比对 logcat 里面的关键参数;但是自己看了下你这个监控 top,每次运行至请求一次,好像 logcat 也用不了....
|