在python3中通过plumbum执行sudo



有人可以帮我完成以下代码吗?试图弄清楚如何通过铅垂执行 sudo 命令

from plumbum import cmd
osTyp = cmd.uname('-s').strip()
print('The Os is:', osTyp)
def S1():
if osTyp == 'Linux':
cmd.sudo(["systemctl", "stop", "dbora.service"])

来自 plumbum import cmd

osTyp = cmd.uname('-s'(.strip(( print('The Os is:', osTyp(

如果 osTyp == 'Linux': cmd.sudo(["systemctl", "stop", "dbora.service"](

最新更新