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

你可能感兴趣的:(python自动化脚本)