cmd = os.popen(‘adb shell dumpsys activity|findstr mFocus‘).read()
执行上述代码后会os.popen后台并不会结束
需要改为
cmd = os.popen(‘adb shell dumpsys activity|findstr mFocus‘) data = cmd.read() cmd.close()
【python】关闭 os.popen()的方法
原文:https://www.cnblogs.com/ffrs/p/12939683.html