2 對於Ubuntu的: os.popen('gnome-screensaver-command --lock') (Source) 對於Windows: import ctypes ctypes.windll.user32.LockWorkStation() (Source) 來源 2017-01-01 01:37:56