思路:通过adb reboot命令来控制android手机自动重启
#!/usr/bin/env python
# -*- coding: utf-8 -*-
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(60)
if __name__ == '__main__':
#控制重启执行次数
count=int(input("请输入重启次数:"))
app = Reboot(count)
app.controlReboot()