2

I want to find out if I can launch a function or a method in a python program right before the computer sleep, something that goes along the line of

def f():
    if about_to_sleep:
        do_stuff
    else:
        do_some_other_stuff

that can work in windows 10

user208685
  • 111
  • 2
  • 9
  • 1
    Possible duplicate of [Python - Windows Shutdown Events](http://stackoverflow.com/questions/1411186/python-windows-shutdown-events) – Avantol13 Mar 07 '17 at 14:37
  • possibly related: https://stackoverflow.com/questions/16145516/detecting-computer-program-shutdown-in-python – blackgreen Mar 04 '23 at 13:43

0 Answers0