Код: Выделить всё
import subprocess
# Here code required to log the time at which system going to sleep
command = 'Sleep.py'
# Some usefull stuff
if subprocess.call(command, shell=True):
print 'Success'
else:
print 'Fail'
< /code>
Ниже приведен код 'sleep.py': < /p>
import os
os.system("Rundll32.exe Powrprof.dll,SetSuspendState Sleep")
Подробнее здесь: https://stackoverflow.com/questions/502 ... sleep-mode