Home > Backend Development > Python Tutorial > 使用python编写批量卸载手机中安装的android应用脚本

使用python编写批量卸载手机中安装的android应用脚本

WBOY
Release: 2016-06-16 08:43:08
Original
1401 people have browsed it

该脚本的功能是卸载android手机中安装的所有第三方应用,主要是使用adb shell pm、adb uninstall 命令,所以使用的前提是需要配好adb的环境变量,下面上代码:

#!/usr/bin/env python 

import os 

def uninstall(): 
os.popen("adb wait-for-device") 
print "start uninstall..." 
for packages in os.popen("adb shell pm list packages -3").readlines(): 
packageName = packages.split(":")[-1].splitlines()[0] 
os.popen("adb uninstall " + packageName) 
print "uninstall " + packageName + " successed." 

if __name__ == "__main__": 
uninstall() 
print " " 
print "All the third-party applications uninstall successed." 
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template