2017-01-01 91 views

回答

2

對於Ubuntu的:

os.popen('gnome-screensaver-command --lock') 

Source

對於Windows:

import ctypes 
ctypes.windll.user32.LockWorkStation() 

Source