使用 Python 注销 Windows

vpa*_*ade 5 python logoff logout

我应该使用哪个 Python 函数来注销当前用户。我找到了一个锁定我的电脑的示例,例如 Win+L 组合

ctypes.windll.user32.LockWorkStation ()

但我需要一个类似的功能,它将注销。

Sid*_*Bob 1

尝试os.system("shutdown -l")

shutdown -l是用于注销的 Windows shell 命令