教程集 www.jiaochengji.com
教程集 >  Python编程  >  Python入门  >  正文 关于Python脚本中执行adb命令的方法

关于Python脚本中执行adb命令的方法

发布时间:2021-01-31   编辑:jiaochengji.com
教程集为您提供关于Python脚本中执行adb命令的方法等资源,欢迎您收藏本站,我们将为您提供最新的关于Python脚本中执行adb命令的方法资源

之前已经讲过Python基础知识,怎么样在Python中写出脚本。今天我们继续学习python怎么写脚本来执行adb命令。

Python的os包中,可以通过os.system 或 os.popen来实现本地adb命令的调用。

建立下图的文件结构:

app文件夹中放上要执行安装的apk,Python的代码如下:

import os import time flies = os.listdir("app"); for ff in flies:   print "adb install -r " ff   text = os.popen("adb install -r app/" ff)   time.sleep(2)   print text.read();

是不是步骤简单容易操作,大家可以上手尝试一下。更多python实用知识,点击进入JQ教程网Python大全

您可能感兴趣的文章:
python脚本如何测试手机
关于Python脚本中执行adb命令的方法
python如何操作手机
linux怎么执行python脚本
linux如何打开python
python控制台是什么意思
python换行符是什么?
怎样在linux上执行python程序
linux中如何使用python
怎么用dos编译python

[关闭]
~ ~