該腳本的功能是卸載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."
新聞熱點
疑難解答