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()

 

posted @ 2021-04-16 09:18  酷酷的小庄  阅读(292)  评论(0编辑  收藏  举报
/* 鼠标点击求赞文字特效 */