Please use below script to lock windows workstation,
import os;
out=os.popen("rundll32.exe user32.dll, LockWorkStation").read();
print(out);
Sample output would be,
Please use below script to lock windows workstation,
import os;
out=os.popen("rundll32.exe user32.dll, LockWorkStation").read();
print(out);
Sample output would be,