python自动循环重启android系统

提前条件adb reboot可以控制android系统重启

import os
import time
class Reboot():

    def __init__(self,count):
        self.count = count

    def reboot(self):
        cmd='adb reboot'
        os.popen(cmd)

    def controlReboot(self):

        i=1
        while (self.count >0):
            self.reboot()
            print("第 %d 次重启" % i)
            i = i +1
            self.count = self.count - 1
            time.sleep(40)

if __name__ == '__main__':

   #控制重启执行次数
   count=int(input("请输入重启次数:"))
   app = Reboot(count)
   app.controlReboot()
原文地址:https://www.cnblogs.com/laochun/p/14665489.html