Python脚本连接adb某个应用实时监控

Python 3.5 的网上的容易找到的是2的

import os
import sys
import datetime

import time

import subprocess

count = 1
while (count < 2):
    time.sleep(1)
    p1 = subprocess.Popen('adb -s 8400503444243c2309cd shell ps '
                          '| busybox grep -r com.yanjun',
                          stdout=subprocess.PIPE,
                          stderr=subprocess.PIPE)
    x = p1.stdout.readlines()
    now = datetime.datetime.now()
    z = now.strftime('%Y-%m-%d %H:%M:%S') + str(x[0])
    print(z)
    with open("shine.shineplay.txt", "a") as f:
        f.write(z)

你可能感兴趣的:(Python脚本连接adb某个应用实时监控)