python自动循环幻醒灭屏

import time
import os
class App:
    def __init__(self,count):
        self.count=count
    def wakeup_sleep(self):
        cmd="adb shell input keyevent 26"
        os.popen(cmd)
        time.sleep(10)
    def autoWakeupSleep(self):
        i=1
        while (self.count >0):
            print("唤醒/灭屏第%d次" %i)
            i+=1
            self.wakeup_sleep()
            self.count=self.count - 1

if __name__ == '__main__':
    count=int(input("请输入唤醒灭屏次数:"))
    wakeSleep=App(count)
    wakeSleep.autoWakeupSleep()
原文地址:https://www.cnblogs.com/laochun/p/14665515.html